コード例 #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_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")
                                            });
        }
コード例 #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_ExplicitPropertySet_IgnoresExplicitProperty ()
        {
            // arrange
            var obj = new DisplayFormatAttributeTestObject ();
            ((IExplicitInterface) obj).ExplicitProperty = "test";


            // act
            var result = obj.PropertiesToRouteValueDictionary ();


            // assert
            result.Should ().NotContain ("ExplicitProperty", "test");
        }
コード例 #6
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");
        }