Example #1
0
        public void TestAllSlotsHoldsEverySlot()
        {
            ISlotContentObserver observer = new FakeSlotContentObserver();
            SlotContentHistory   history  = new SlotContentHistory(observer);
            AllSlots             sut      = new AllSlots(history);

            List <SlotContent> blueSlots = new List <SlotContent>()
            {
                SlotContent.Empty, SlotContent.Empty, SlotContent.Bot, SlotContent.Player, SlotContent.Empty,
                SlotContent.Empty
            };
            List <SlotContent> redSlots = new List <SlotContent>()
            {
                SlotContent.Bot, SlotContent.Bot, SlotContent.Bot, SlotContent.Player, SlotContent.Player, SlotContent.Empty
            };

            history.Update();

            List <int> blueResult = sut.Slots(Team.Blue);
            List <int> redResult  = sut.Slots(Team.Red);

            List <int> blueExpectation = new List <int>()
            {
                0, 1, 2, 3, 4, 5
            };
            List <int> redExpectation = new List <int>()
            {
                6, 7, 8, 9, 10, 11
            };

            Assert.IsTrue(blueResult.SequenceEqual(blueExpectation));
            Assert.IsTrue(redResult.SequenceEqual((redExpectation)));
        }
Example #2
0
        public void TestPlayerSlots()
        {
            FakeSlotContentObserver observer = new FakeSlotContentObserver();
            SlotContentHistory      history  = new SlotContentHistory(observer);
            PlayerSlots             sut      = new PlayerSlots(history);

            List <SlotContent> blueSlots = new List <SlotContent>()
            {
                SlotContent.Empty, SlotContent.Empty, SlotContent.Bot, SlotContent.Player, SlotContent.Empty,
                SlotContent.Empty
            };
            List <SlotContent> redSlots = new List <SlotContent>()
            {
                SlotContent.Bot, SlotContent.Bot, SlotContent.Bot, SlotContent.Player, SlotContent.Player, SlotContent.Empty
            };

            observer.SetObserve(blueSlots, redSlots);

            history.Update();

            List <int> blueResult = sut.Slots(Team.Blue);
            List <int> redResult  = sut.Slots(Team.Red);

            List <int> blueExpectation = new List <int>()
            {
                3
            };
            List <int> redExpectation = new List <int>()
            {
                9, 10
            };

            Assert.IsTrue(blueResult.SequenceEqual(blueExpectation));
            Assert.IsTrue(redResult.SequenceEqual((redExpectation)));
        }
Example #3
0
        public void TestWhenRedHasMoreBotsThenRedHasFewerBotsIsFalse()
        {
            FakeSlotContentObserver observer = new FakeSlotContentObserver();
            SlotContentHistory      history  = new SlotContentHistory(observer);
            BotSlots sut = new BotSlots(history);

            List <SlotContent> blueSlots = new List <SlotContent>()
            {
                SlotContent.Empty, SlotContent.Empty, SlotContent.Bot, SlotContent.Player, SlotContent.Empty,
                SlotContent.Empty
            };
            List <SlotContent> redSlots = new List <SlotContent>()
            {
                SlotContent.Bot, SlotContent.Bot, SlotContent.Bot, SlotContent.Player, SlotContent.Player, SlotContent.Empty
            };

            observer.SetObserve(blueSlots, redSlots);

            history.Update();

            Assert.IsFalse(sut.TeamHasFewer(Team.Red));
        }
Example #4
0
        public void TestWhenPlayerCountSameThenTeamsHaveEqualCountIsTrue()
        {
            FakeSlotContentObserver observer = new FakeSlotContentObserver();
            SlotContentHistory      history  = new SlotContentHistory(observer);
            PlayerSlots             sut      = new PlayerSlots(history);

            List <SlotContent> blueSlots = new List <SlotContent>()
            {
                SlotContent.Empty, SlotContent.Empty, SlotContent.Bot, SlotContent.Player, SlotContent.Empty,
                SlotContent.Empty
            };
            List <SlotContent> redSlots = new List <SlotContent>()
            {
                SlotContent.Bot, SlotContent.Bot, SlotContent.Bot, SlotContent.Player, SlotContent.Bot, SlotContent.Empty
            };

            observer.SetObserve(blueSlots, redSlots);

            history.Update();

            Assert.IsTrue(sut.TeamsHaveEqualCount);
        }
Example #5
0
        public void TestSlotContentHistoryLengthEqualToNumUpdates()
        {
            FakeSlotContentObserver observer = new FakeSlotContentObserver();
            SlotContentHistory      sut      = new SlotContentHistory(observer);

            List <SlotContent> blueSlots = new List <SlotContent>()
            {
                SlotContent.Empty, SlotContent.Empty, SlotContent.Bot, SlotContent.Player, SlotContent.Empty,
                SlotContent.Empty
            };
            List <SlotContent> redSlots = new List <SlotContent>()
            {
                SlotContent.Bot, SlotContent.Bot, SlotContent.Bot, SlotContent.Player, SlotContent.Player, SlotContent.Empty
            };

            Assert.AreEqual(sut.History(4).Count, 0);

            sut.Update();
            Assert.AreEqual(sut.History(0).Count, 1);

            sut.Update();
            Assert.AreEqual(sut.History(11).Count, 2);
        }