public void When_an_object_is_binary_serializable_but_not_deserializable_it_should_fail()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new BinarySerializableClassMissingDeserializationConstructor
            {
                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("constructor to deserialize"));
        }
Ejemplo n.º 2
0
            public void When_an_object_is_binary_serializable_but_not_deserializable_it_should_fail()
            {
                // Arrange
                var subject = new BinarySerializableClassMissingDeserializationConstructor
                {
                    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:*BinarySerializableClassMissingDeserializationConstructor*");
            }
        public void When_an_object_is_binary_serializable_but_not_deserializable_it_should_fail()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new BinarySerializableClassMissingDeserializationConstructor
            {
                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("constructor to deserialize"));
        }