Commit d6b3738
Changed files (4)
product
testing
unit
utility
utility
product/testing/unit/utility/SettingsSpecs.cs
@@ -20,13 +20,13 @@ namespace specs.unit.utility
public class when_pulling_out_a_setting : concern
{
- It should_return_the_correct_value = () => result.should_be_equal_to("blah");
+ It should_return_the_correct_value = () => result.should_be_true();
- Establish context = () => { settings["the.key"] = "blah"; };
+ Establish context = () => { settings["the.key"] = "true"; };
- Because of = () => { result = sut.named<string>("the.key"); };
+ Because of = () => { result = sut.named<bool>("the.key"); };
- static string result;
+ static bool result;
}
}
}
\ No newline at end of file
product/utility/ConversionExtensions.cs
@@ -13,9 +13,7 @@ namespace gorilla.utility
public static T converted_to<T>(this object item_to_convert)
{
if (item_to_convert.is_an_implementation_of<IConvertible>())
- {
return (T) Convert.ChangeType(item_to_convert, typeof (T));
- }
return item_to_convert.downcast_to<T>();
}
product/utility/Settings.cs
@@ -13,7 +13,7 @@ namespace gorilla.utility
public T named<T>(string key)
{
- return settings[key].downcast_to<T>();
+ return settings[key].converted_to<T>();
}
}
}
\ No newline at end of file
.gitignore
@@ -17,3 +17,4 @@ artifacts
installation
*.user
%APPDATA%
+*.stackdump