Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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")
                                            });
        }
Esempio n. 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")
            });
        }
Esempio n. 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");
        }