public void Should_create_failure()
        {
            // Arrange
            const string expectedMessage = "Failure";

            // Act
            var result = ExpectationResult.CreateFailureResult(expectedMessage);

            // Assert
            Assert.That(result.ExpectationsMet, Is.False);
            Assert.That(result.Message, Is.EqualTo(expectedMessage));
            Assert.That(result.ToString(), Is.EqualTo("Failure"));
        }
        public void Should_have_errors()
        {
            // Arrange
            var results = new List <ExpectationResult>
            {
                ExpectationResult.CreateSuccessResult(),
                ExpectationResult.CreateFailureResult("Expected this but was that for X"),
                ExpectationResult.CreateFailureResult("Expected that but was this for Y"),
                ExpectationResult.CreateSuccessResult(),
                ExpectationResult.CreateFailureResult("Expected this but was that for Z")
            };

            // Act
            var errorMessages = results.ErrorMessages();

            // Assert
            Assert.That(results.Valid(), Is.False);
            Assert.That(errorMessages, Is.EqualTo("Expected this but was that for X\r\nExpected that but was this for Y\r\nExpected this but was that for Z"));
        }
Exemple #3
0
 public ExpectationResult Handle(string message)
 {
     return(ExpectationResult.CreateFailureResult(message));
 }