예제 #1
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            try
            {
                GeneratorParameters.People.Add(new Person {
                    Name = "Becks"
                });
                GeneratorParameters.People.Add(new Person {
                    Name = "B"
                });
                GeneratorParameters.People.Add(new Person {
                    Name = "R"
                });
                GeneratorParameters.People.Add(new Person {
                    Name = "Colon"
                });
                _generatorService.Run(GeneratorParameters);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(RedirectToPage("./ShowTeams"));
        }
        public void GeneratesSameNumberOfTeamsAsPeopleWhenMaxPeoplePerTeamIsOne()
        {
            // Arrange
            int             maxPeoplePerTeam = 1;
            GeneratorParams userOptions      = new GeneratorParams
            {
                MaximumPeoplePerTeam = maxPeoplePerTeam,
                People      = TestData.NinePeople,
                RandomizeBy = RandomizeBy.MaximumPeoplePerTeam
            };
            int expectedNumberOfTeams = userOptions.People.Count;

            // Act
            _createdTeams = _generator.Run(userOptions).ToList();

            // Assert
            Assert.Equal(expectedNumberOfTeams, _createdTeams.Count);
        }