public void ExpectingNoSpecificDojo_OnCityWithSpecificAndOtherDojo_ShouldFail()
        {
            // arrange
            var city = new City(new Dojo(MultilinedNarutoUzumaki(), new DateTime(1515, 11, 15)),
                                new Dojo(Kakashi(), new DateTime(1500, 1, 1)));

            // act
            var result = city.Evaluate(
                c => c.Member(x => x.Dojos).HasNone(d => d.Member(x => x.Master).Fulfills(n => n.Member(x => x.Age) .IsEqualTo(26)
                                                                                                .Member(x => x.Name).IsEqualTo("Kakashi"))
                                                          .Member(x => x.Founded).IsOnSameDayAs(new DateTime(1500, 1, 1))));

            // assert
            Console.Out.WriteLine(result.PrintLog());
            Assert.AreEqual(
                            "City: (X)Dojos = <1 match>                                     (expected: 0 matches)"  .NewLine()
                       .Add("                 Dojo: (X)Master  = Ninja: (X)Age  = 12        (expected: 26)")        .NewLine()
                       .Add("                                           (X)Name = 'Naruto   (expected: 'Kakashi')") .NewLine()
                       .Add("                                                      Uzumaki' ")                      .NewLine()
                       .Add("                       (X)Founded = 11/15/1515                 (expected: 01/01/1500)").NewLine()
                       .Add("                 Dojo: ( )Master  = Ninja: ( )Age  = 26        (expected: 26)")        .NewLine()
                       .Add("                                           ( )Name = 'Kakashi' (expected: 'Kakashi')") .NewLine()
                       .Add("                       ( )Founded = 01/01/1500                 (expected: 01/01/1500)"),
                   result.PrintLog());
            Assert.IsFalse(result.succeeded);
        }
Пример #2
0
 public void IsNull_WithNullDojos_ShouldPass()
 {
     var city = new City(dojoList: null);
     ObjectAssertionResult result = city.Evaluate(n => n.Property(x => x.Dojos).IsNull());
     Assert.IsTrue(result.succeeded);
     Assert.AreEqual("City: ( )Dojos = null (expected: null)", result.PrintLog());
 }
Пример #3
0
 public void IsNull_OnCityWithoutDojo_ShouldFail()
 {
     var city = new City();
     ObjectAssertionResult result = city.Evaluate(c => c.Property(x => x.Dojos).IsNull());
     Assert.IsFalse(result.succeeded);
     Assert.AreEqual("City: (X)Dojos = <empty> (expected: null)", result.PrintLog());
 }
Пример #4
0
 public void IsEmpty_OnCityWithoutDojo_ShouldSucceed()
 {
     var city = new City();
     ObjectAssertionResult result = city.Evaluate(c => c.Property(x => x.Dojos).IsEmpty());
     Assert.IsTrue(result.succeeded);
     Assert.AreEqual("City: ( )Dojos = <empty> (expected: empty enumerable)", result.PrintLog());
 }
Пример #5
0
 public void IsEmpty_OnCityWithDojo_ShouldFail()
 {
     var city = new City(new Dojo(new Ninja(), Dates.StandardDay()));
     ObjectAssertionResult result = city.Evaluate(c => c.Property(x => x.Dojos).IsEmpty());
     Assert.IsFalse(result.succeeded);
     Console.Out.WriteLine(result.PrintLog());
     Assert.AreEqual("City: (X)Dojos = <1 Dojo> (expected: empty enumerable)", result.PrintLog());
 }
Пример #6
0
 public void IsEmpty_OnCityNullDojos_ShouldFail()
 {
     var city = new City(dojoList:null);
     ObjectAssertionResult result = city.Evaluate(c => c.Property(x => x.Dojos).IsEmpty());
     Assert.IsFalse(result.succeeded);
     Console.Out.WriteLine(result.PrintLog());
     Assert.AreEqual("City: (X)Dojos = null (expected: empty enumerable)", result.PrintLog());
 }
Пример #7
0
 public void HasAnyStandardDayDojo_OnCityWithStandardDayDojo_ShouldPass()
 {
     var city = new City(new Dojo(new Ninja(), Dates.StandardDay()));
     var result = city.Evaluate(
         c => c.Property(x => x.Dojos).HasAny(d => d.Property(x => x.Founded).OnSameDayAs(Dates.StandardDay())));
     Assert.IsTrue(result.succeeded);
     Console.Out.WriteLine(result.PrintLog());
     Assert.AreEqual("City: ( )Dojos = <1 match>                     (expected: at least 1 match)".NewLine()
                .Add("                 Dojo: ( )Founded = 11/16/1984 (expected: 11/16/1984)"), result.PrintLog());
 }
        public void ExpectingStandardDayDojo_OnCityWithOldAndStandardDayDojo_ShouldSucceed()
        {
            // arrange
            var city = new City(new Dojo(Naruto(), new DateTime(1515, 11, 15)),
                                new Dojo(Naruto(), Dates.StandardDay()));

            // act
            var result = city.Evaluate(
                c => c.Member(x => x.Dojos).HasAny(d => d.p(x => x.Founded).IsOnSameDayAs(Dates.StandardDay())));

            // assert
            result.ExAssert(r => r.p(x => x.succeeded).IsTrue()
                                  .p(x => x.PrintLog()).IsEqualTo("City: ( )Dojos = <1 match>                     (expected: at least 1 match)".NewLine()
                                                             .Add("                 Dojo: (X)Founded = 11/15/1515 (expected: 11/16/1984)").NewLine()
                                                             .Add("                 Dojo: ( )Founded = 11/16/1984 (expected: 11/16/1984)")));
        }