Added many more unit tests for the membership provider base class and fixed some logic inconsistencies.

This commit is contained in:
Shannon
2013-12-28 18:55:43 +11:00
parent fbdb1d5d6c
commit 8a70c440f2
10 changed files with 422 additions and 245 deletions

View File

@@ -13,23 +13,23 @@ namespace Umbraco.Core
{
return collection.Keys.Cast<object>().Any(k => (string) k == key);
}
public static T GetValue<T>(this NameValueCollection collection, string key, T defaultIfNotFound)
{
if (collection.ContainsKey(key) == false)
{
return defaultIfNotFound;
}
var val = collection[key];
if (val == null)
{
return defaultIfNotFound;
}
var result = val.TryConvertTo<T>();
return result.Success ? result.Result : defaultIfNotFound;
}
public static T GetValue<T>(this NameValueCollection collection, string key, T defaultIfNotFound)
{
if (collection.ContainsKey(key) == false)
{
return defaultIfNotFound;
}
var val = collection[key];
if (val == null)
{
return defaultIfNotFound;
}
var result = val.TryConvertTo<T>();
return result.Success ? result.Result : defaultIfNotFound;
}
}
}