Пример #1
0
        public void GenerateTest3()
        {
            //arrange
            //シングルスのコートが2つ、参加者6人とする
            int           accommodateNumber = 2;
            int           courtNum          = 2;
            List <Person> attendMember      = new List <Person>
            {
                testPerson01,
                testPerson02,
                testPerson03,
                testPerson04,
                testPerson05,
                testPerson06
            };

            //対戦履歴の作成
            Game[] games = new Game[] { testGame01, testGame02, testGame03, testGame04,
                                        testGame05, testGame06, testGame07, testGame08 };
            gameRecorder.Add(games);
            //期待結果
            var expectedBreakPerson = new List <Person> {
                testPerson01, testPerson02
            };

            //act
            (Game[] games, IEnumerable <Person> breakPersons)result = fewMatchPriorityGenerator.Generate(courtNum, attendMember, accommodateNumber);

            //assert
            Assert.Empty(expectedBreakPerson.Except(result.breakPersons));
            Assert.Empty(result.breakPersons.Except(expectedBreakPerson));
        }
Пример #2
0
        public void AddTest03()
        {
            //Arrange
            GameRecorder = GameRecorder.GetInstance;

            //Act
            //Assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  { GameRecorder.Add(null); });
        }
Пример #3
0
        public void AddTest05()
        {
            //Arrange
            Game[] games = new Game[] { };
            GameRecorder = GameRecorder.GetInstance;

            //Act
            //Assert
            Assert.Throws <ArgumentException>(() =>
                                              { GameRecorder.Add(games); });
        }
Пример #4
0
        public void GetTimesTest09()
        {
            //Arrange
            Game[] games = new Game[] { testGame01, testGame01 };
            GameRecorder = GameRecorder.GetInstance;
            GameRecorder.Add(games);

            //Act
            //Assert
            Assert.Throws <ArgumentException>(() =>
                                              { GameRecorder.GetTimes(testPerson01, testPerson01); });
        }
Пример #5
0
        public void AddTest02()
        {
            //Arrange
            Game[] games = new Game[] { testGame01, testGame01, testGame01, testGame01 };
            GameRecorder = GameRecorder.GetInstance;

            //Act
            GameRecorder.Add(games);
            int expected = 4;
            int actual   = GameRecorder.GetTimes(testPerson01, testPerson02);

            //Assert
            Assert.Equal(expected, actual);
        }
Пример #6
0
        public void GetTimesTest04()
        {
            //Arrange
            Game[] games = new Game[] { testGame01, testGame01, testGame02 };
            GameRecorder = GameRecorder.GetInstance;
            GameRecorder.Add(games);

            //Act
            int actualCount   = GameRecorder.GetTimes(testPerson02, testPerson03);
            int expectedCount = 0;

            //Assert
            Assert.Equal(expectedCount, actualCount);
        }