public void dynamic_get_property_value_throws_exception_if_key_not_provided() { var props = new DynaProps(); props.Properties.Key = "value"; Should.Throw <ArgumentNullException>(() => props.GetPropertyValueAs <string>(null)); Should.Throw <ArgumentNullException>(() => props.GetPropertyValueAs <string>(string.Empty)); Should.Throw <ArgumentNullException>(() => props.GetPropertyValueAs <string>("")); }
public void dynamic_get_property_value_throws_excecption_if_can_not_convert() { var props = new DynaProps(); props.Properties.Key = "value"; Should.Throw <InvalidCastException>(() => props.GetPropertyValueAs <FakeType>("Key")); }
public void dynamic_get_property_value_throws_exception_if_key_not_found() { var props = new DynaProps(); props.Properties.Key = "value"; Should.Throw <DynamicValueNotFoundException>(() => props.GetPropertyValueAs <string>("AnotheKey")); }
public void dynamic_get_property_value_can_covert_between_types() { var props = new DynaProps(); props.Properties.MyNumber = 50; var val = props.GetPropertyValueAs <string>("MyNumber"); val.GetType().ShouldBe(typeof(string)); val.Equals("50").ShouldBeTrue(); }
public void dynamic_get_property_value_returns_value_as_specified_type() { var props = new DynaProps(); props.Properties.Key = "value"; var val = props.GetPropertyValueAs <string>("Key"); val.Equals("value").ShouldBeTrue(); val.GetType().ShouldBe(typeof(string)); }