Example #1
0
        public void Assert_WithNull_AndNullAssertion_ShouldPass()
        {
            Ninja ninja  = null;
            var   result = ninja.Evaluate(
                n => n.IsNull());

            Assert.IsTrue(result.succeeded);
            Assert.AreEqual("null (expected: null)", result.PrintLog());
        }
Example #2
0
        public void Assert_WithNull_AndNameAssertion_ShouldReturnTestFail()
        {
            Ninja nullNinja = null;

            Result result =
                nullNinja.Evaluate(n =>
                                   n.Member(x => x.Age).IsEqualTo(12));

            result.ExAssert(r =>
                            r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.actual).IsEqualTo("null")
                            .Member(x => x.expectation).IsEqualTo("(expected: not null)"));
        }
Example #3
0
        public void ExpectingNaruto_OnTriplelinedNaruto_ShouldFail()
        {
            // arrange
            var kurama = new Ninja($"Naruto{NewLine}" +
                                   $"Kuruma{NewLine}" +
                                   $"Uzumaki");

            // act
            Result result = kurama.Evaluate(n => n.Member(x => x.Name).IsEqualTo("Naruto")
                                            .Member(x => x.Age).IsEqualTo(12));

            Console.WriteLine(result.PrintLog());
            // assert
            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.PrintLog()).IsEqualTo($"Ninja: (X)Name = 'Naruto   (expected: 'Naruto'){NewLine}" +
                                                                 $"                  Kuruma   {NewLine}" +
                                                                 $"                  Uzumaki' {NewLine}" +
                                                                 $"       ( )Age  = 12        (expected: 12)"));
        }