public void When_an_object_is_not_xml_serializable_it_should_fail() { // Arrange var subject = new NonPublicClass { Name = "John" }; // Act Action act = () => subject.Should().BeXmlSerializable("we need to store it on {0}", "disk"); // Assert act.Should().Throw <XunitException>() .WithMessage("*to be serializable because we need to store it on disk, but serialization failed with:*NonPublicClass*"); }
public void When_an_object_is_not_xml_serializable_it_should_fail() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var subject = new NonPublicClass { Name = "John" }; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => subject.Should().BeXmlSerializable("we need to store it on {0}", "disk"); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act .ShouldThrow <AssertFailedException>() .Where(ex => ex.Message.Contains("to be serializable because we need to store it on disk, but serialization failed with:") && ex.Message.Contains("Only public types can be processed")); }
public void When_an_object_is_not_xml_serializable_it_should_fail() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var subject = new NonPublicClass { Name = "John" }; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => subject.Should().BeXmlSerializable("we need to store it on {0}", "disk"); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act .ShouldThrow<AssertFailedException>() .Where(ex => ex.Message.Contains("to be serializable because we need to store it on disk, but serialization failed with:") && ex.Message.Contains("Only public types can be processed")); }