Exemplo n.º 1
0
        public void OnSwordShurikenAndBow_WithSwordAndShuriken_ShouldPass()
        {
            var result = threeWeaponNinja.Evaluate(n => n.Member(x => x.Weapons).ContainsInOrder("Sword", "Shuriken"));

            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue()
                            .Member(x => x.actual).IsEqualTo("WeaponedNinja: ( )Weapons = ['Sword', 'Shuriken', 'Bow']")
                            .Member(x => x.expectation).IsEqualTo("(expected: contains in order ['Sword', 'Shuriken'])"));
        }
        public void ExpectingNoWeapon_OnNinjaWithSword_ShouldFail()
        {
            // act
            Result result = swordNinja.Evaluate(n => n.Member(x => x.Weapons).IsEquivalentTo(new List <string>()));

            // assert
            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.PrintLog()).IsEqualTo("WeaponedNinja: (X)Weapons = ['Sword'] (expected: equivalent to <empty>)"));
        }
Exemplo n.º 3
0
        public void OnNinjaWithFirstWeaponNull_WithNull_ShouldPass()
        {
            var ninja = new WeaponedNinja(null, "Shuriken");

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).StartsWith(null));

            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue());
        }
Exemplo n.º 4
0
        public void OnSwordShurikenAndNull_WithShurikenAndNull_ShouldPass()
        {
            var ninja = new WeaponedNinja("Sword", "Shuriken", null);

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).ContainsInOrder("Shuriken", null));

            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue());
        }
Exemplo n.º 5
0
        public void OnNullWeapons_WithSword_ShouldFail()
        {
            var ninja = new WeaponedNinja(null);

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).ContainsInOrder("Sword"));

            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse());
        }
Exemplo n.º 6
0
        public void OnNinjaWithNullWeapons_WithSword_ShouldFail()
        {
            var ninja = new WeaponedNinja(null);

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).StartsWith("Sword"));

            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.actual).IsEqualTo("WeaponedNinja: (X)Weapons = null"));
        }
Exemplo n.º 7
0
        public void OnShurikenAndBow_WithBow_ShouldFail()
        {
            var ninja = new WeaponedNinja("Shuriken", "Bow");

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).StartsWith("Bow"));

            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.expectation).IsEqualTo("(expected: starts with 'Bow')"));
        }
Exemplo n.º 8
0
        public void OnSword_WithNull_ShouldFail()
        {
            var ninja = new WeaponedNinja("Sword");

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).IsSubsetOf(null));

            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.expectation).IsEqualTo("(expected: is subset of null)"));
        }
Exemplo n.º 9
0
        public void OnSwordShurikenAndBow_WithSword_ShouldPass()
        {
            var ninja = new WeaponedNinja("Sword", "Shuriken", "Bow");

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).StartsWith("Sword"));

            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue()
                            .Member(x => x.actual).IsEqualTo("WeaponedNinja: ( )Weapons = ['Sword', 'Shuriken', 'Bow']")
                            .Member(x => x.expectation).IsEqualTo("(expected: starts with 'Sword')"));
        }
Exemplo n.º 10
0
        public void Expecting2_OnNinjaWithThreeWeapons_ShouldFail()
        {
            var ninjaWithThreeWeapons = new WeaponedNinja("Shuriken", "Sword", "Bow");

            var result = ninjaWithThreeWeapons.Evaluate(n => n.p(x => x.Weapons).HasCount(2));

            result.ExAssert(r =>
                            r.p(x => x.succeeded).IsFalse()
                            .p(x => x.PrintLog()).IsEqualTo("WeaponedNinja: (X)Weapons = <3 Strings> (expected: 2 Strings)"));
        }
Exemplo n.º 11
0
        public void OnSwordAndNullWeapon_WithSwordAndNull_ShouldPass()
        {
            var ninja = new WeaponedNinja("Sword", null);

            var result = ninja.Evaluate(n => n.Member(x => x.Weapons).IsSubsetOf("Sword", null));

            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue()
                            .Member(x => x.actual).IsEqualTo("WeaponedNinja: ( )Weapons = ['Sword', null]")
                            .Member(x => x.expectation).IsEqualTo("(expected: is subset of ['Sword', null])"));
        }
Exemplo n.º 12
0
        public void ExpectingSword_OnNinjaWithShuriken_ShouldFail()
        {
            // arrange
            var shurikenNinja = new WeaponedNinja("Shuriken");

            // act
            Result result = shurikenNinja.Evaluate(n => n.Member(x => x.WeaponList()).IsEqualTo("Sword"));

            // assert
            Assert.IsFalse(result.succeeded);
        }
Exemplo n.º 13
0
        public void ExpectingContainWord_OnNinjaWithSword_ShouldSucceed()
        {
            // arrange
            var ninja = new WeaponedNinja("Sword");

            // act
            Result result = ninja.Evaluate(n => n.Member(x => x.Weapons).FulfilAll(w => w.Contains("word")));

            // assert
            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue()
                            .Member(x => x.PrintLog()).IsEqualTo("WeaponedNinja: ( )Weapons = ['Sword'] (expected: all fulfil w => w.Contains(\"word\"))"));
        }
        public void ExpectingSwordAndNull_OnNinjaWithSwordAndNull_ShouldSucceed()
        {
            // arrange
            var ninja = new WeaponedNinja("Sword", null);

            // act
            Result result = ninja.Evaluate(n => n.Member(x => x.Weapons).IsEquivalentTo(null, "Sword"));

            // assert
            result.ExAssert(r => r.Member(x => x.succeeded).IsTrue()
                            .Member(x => x.PrintLog()).IsEqualTo("WeaponedNinja: ( )Weapons = ['Sword', null] (expected: equivalent to [null, 'Sword'])"));
        }
Exemplo n.º 15
0
        public void OnNinjaWithSwordAndNull_ShouldFail()
        {
            // arrange
            var ninja = new WeaponedNinja("Sword", null);

            // act
            Result result = ninja.Evaluate(n => n.Member(x => x.Weapons).DoesntContainNulls());

            // assert
            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.PrintLog()).IsEqualTo("WeaponedNinja: (X)Weapons = ['Sword', null] (expected: doesn't contain nulls)"));
        }
Exemplo n.º 16
0
        public void ExpectingSwordAndShuriken_OnNinjaWithSwordAndNull_ShouldFail()
        {
            // arrange
            var ninja = new WeaponedNinja("Sword", null);

            // act
            Result result = ninja.Evaluate(n => n.Member(x => x.WeaponList()).IsEqualTo("Sword", "Shuriken"));

            // assert
            result.ExAssert(r => r.Member(x => x.succeeded).IsFalse()
                            .Member(x => x.actual).IsEqualTo("WeaponedNinja: (X)WeaponList() = ['Sword', null]")
                            .Member(x => x.expectation).IsEqualTo(Expected("['Sword', 'Shuriken']")));
        }