예제 #1
0
        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");
        }
예제 #2
0
        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");
        }
예제 #3
0
        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");
        }
예제 #4
0
        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")
                                            });
        }
예제 #5
0
        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")
            });
        }
예제 #6
0
        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");
        }