コード例 #1
0
        public void TestIfEmptyPlayerListsThrowException()
        {
            var players  = new Players();
            var allToAll = new AllToAllOponentsCreator();

            Assert.That(() => allToAll.CrateOponentsForGames(players), Throws.TypeOf <CgcCannotCreateOponentsExceptions>());
        }
コード例 #2
0
        public void TestIfGameWithThreePlayerCreateProperOponentsCollection()
        {
            var players  = this.CreatePlayersCollection(3);
            var allToAll = new AllToAllOponentsCreator();
            var oponents = allToAll.CrateOponentsForGames(players);

            Assert.AreEqual(oponents.Count, 3);
        }
コード例 #3
0
        public void TestIfGameWithOnePlayerThrowException()
        {
            var players = new Players {
                new Player()
            };
            var allToAll = new AllToAllOponentsCreator();

            Assert.That(() => allToAll.CrateOponentsForGames(players), Throws.TypeOf <CgcCannotCreateOponentsExceptions>());
        }
コード例 #4
0
        public void TestIfGameWithTwoPlayerCreateProperOponentsCollection()
        {
            var players  = this.CreatePlayersCollection(2);
            var allToAll = new AllToAllOponentsCreator();
            var oponents = allToAll.CrateOponentsForGames(players);

            Assert.AreEqual(oponents.Count, 1);
            Assert.IsTrue(oponents.First().TeamA.Count == 1);
            Assert.IsTrue(oponents.First().TeamB.Count == 1);
            Assert.IsTrue(oponents.First().TeamA != oponents.First().TeamB);
            Assert.IsTrue(oponents.First().TeamA.First().Name != oponents.First().TeamB.First().Name);
            Assert.IsFalse(string.IsNullOrEmpty(oponents.First().TeamA.First().Name));
            Assert.IsFalse(string.IsNullOrEmpty(oponents.First().TeamB.First().Name));
            Assert.IsTrue(oponents.First().TeamA.First().Name == "player0" || oponents.First().TeamA.First().Name == "player1");
        }