Beispiel #1
0
            public void When_injecting_null_options_it_should_throw()
            {
                // Arrange
                var subject = new SerializableClassWithNonSerializableMember();

                // Act
                Action act = () => subject.Should().BeBinarySerializable <SerializableClassWithNonSerializableMember>(options: null);

                // Assert
                act.Should().ThrowExactly <ArgumentNullException>()
                .WithParameterName("options");
            }
Beispiel #2
0
            public void When_an_object_is_binary_serializable_with_non_serializable_members_it_should_succeed()
            {
                // Arrange
                var subject = new SerializableClassWithNonSerializableMember()
                {
                    Name            = "John",
                    NonSerializable = "Nonserializable value"
                };

                // Act
                Action act = () => subject.Should().BeBinarySerializable <SerializableClassWithNonSerializableMember>(options =>
                                                                                                                      options.Excluding(s => s.NonSerializable));

                // Assert
                act.Should().NotThrow();
            }
        public void When_an_object_is_binary_serializable_with_non_serializable_members_it_should_succeed()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            var subject = new SerializableClassWithNonSerializableMember()
            {
                Name = "John",
                NonSerializable = "Nonserializable value"
            };

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            Action act = () => subject.Should().BeBinarySerializable<SerializableClassWithNonSerializableMember>(options =>
                options.Excluding(s => s.NonSerializable));

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            act.ShouldNotThrow();
        }