public void PropertiesToRouteValueDictionary_ExplicitPropertySet_IgnoresExplicitProperty() { // arrange var obj = new DisplayFormatAttributeTestObject(); ((IExplicitInterface)obj).ExplicitProperty = "test"; // act var result = obj.PropertiesToRouteValueDictionary(); // assert result.Should().NotContain("ExplicitProperty", "test"); }
public void PropertiesToRouteValueDictionary_PropertyWithDisplayFormatAttribute_AndHtmlEncodeTrue_ShouldNotHtmlEncode () { // arrange var obj = new DisplayFormatAttributeTestObject { HtmlEncodedString = "a b" }; // act var result = obj.PropertiesToRouteValueDictionary (); // assert result.Should ().Contain ("HtmlEncodedString", "a b"); }
public void PropertiesToRouteValueDictionary_PropertyWithDisplayFormatAttribute_AndHtmlEncodeTrue_ShouldNotHtmlEncode() { // arrange var obj = new DisplayFormatAttributeTestObject { HtmlEncodedString = "a b" }; // act var result = obj.PropertiesToRouteValueDictionary(); // assert result.Should().Contain("HtmlEncodedString", "a b"); }
public void PropertiesToRouteValueDictionary_PropertyWithDisplayFormatAttribute_UsesDataFormatString () { // arrange var obj = new DisplayFormatAttributeTestObject { Date = new DateTime (2000, 1, 2), Number = 1.234m }; // act var result = obj.PropertiesToRouteValueDictionary (); // assert result.ShouldAllBeEquivalentTo (new[] { new KeyValuePair<string, object> ("Date", "02 01 2000"), new KeyValuePair<string, object> ("Number", "1.23"), new KeyValuePair<string, object> ("HtmlEncodedString", "null") }); }
public void PropertiesToRouteValueDictionary_PropertyWithDisplayFormatAttribute_UsesDataFormatString() { // arrange var obj = new DisplayFormatAttributeTestObject { Date = new DateTime(2000, 1, 2), Number = 1.234m }; // act var result = obj.PropertiesToRouteValueDictionary(); // assert result.ShouldAllBeEquivalentTo(new[] { new KeyValuePair <string, object> ("Date", "02 01 2000"), new KeyValuePair <string, object> ("Number", "1.23"), new KeyValuePair <string, object> ("HtmlEncodedString", "null") }); }
public void PropertiesToRouteValueDictionary_ExplicitPropertySet_IgnoresExplicitProperty () { // arrange var obj = new DisplayFormatAttributeTestObject (); ((IExplicitInterface) obj).ExplicitProperty = "test"; // act var result = obj.PropertiesToRouteValueDictionary (); // assert result.Should ().NotContain ("ExplicitProperty", "test"); }