Пример #1
0
        public void When_the_both_properties_are_null_it_should_not_throw()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var expected = new ClassWithMemberDictionary
            {
                Dictionary = null
            };

            var subject = new ClassWithMemberDictionary
            {
                Dictionary = null
            };

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => subject.ShouldBeEquivalentTo(expected);

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act.ShouldNotThrow <AssertFailedException>();
        }
Пример #2
0
        public void When_the_other_property_is_null_it_should_throw()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var expected = new ClassWithMemberDictionary
            {
                Dictionary = null
            };

            var subject = new ClassWithMemberDictionary
            {
                Dictionary = new Dictionary <string, string>
                {
                    { "Key2", "Value2" },
                    { "Key1", "Value1" }
                }
            };

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => subject.ShouldBeEquivalentTo(expected);

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act.ShouldThrow <AssertFailedException>()
            .WithMessage("*member*Dictionary to be <null>, but found *{*}*");
        }