public void When_an_object_is_binary_serializable_but_doesnt_restore_all_properties_it_should_fail()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new BinarySerializableClassNotRestoringAllProperties
            {
                Name     = "John",
                BirthDay = 20.September(1973)
            };

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => subject.Should().BeBinarySerializable();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act
            .ShouldThrow <AssertFailedException>()
            .Where(ex =>
                   ex.Message.Contains("to be serializable, but serialization failed with:") &&
                   ex.Message.Contains("property Name to be"));
        }
Example #2
0
            public void When_an_object_is_binary_serializable_but_doesnt_restore_all_properties_it_should_fail()
            {
                // Arrange
                var subject = new BinarySerializableClassNotRestoringAllProperties
                {
                    Name     = "John",
                    BirthDay = 20.September(1973)
                };

                // Act
                Action act = () => subject.Should().BeBinarySerializable();

                // Assert
                act.Should().Throw <XunitException>()
                .WithMessage("*to be serializable, but serialization failed with:*subject.Name*to be*");
            }
        public void When_an_object_is_binary_serializable_but_doesnt_restore_all_properties_it_should_fail()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new BinarySerializableClassNotRestoringAllProperties
            {
                Name = "John",
                BirthDay = 20.September(1973)
            };

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => subject.Should().BeBinarySerializable();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act
                .ShouldThrow<AssertFailedException>()
                .Where(ex =>
                    ex.Message.Contains("to be serializable, but serialization failed with:") &&
                    ex.Message.Contains("property Name to be"));
        }