public void TestThatCreatingADuplicateTeamThrowsException() { _mockContainer.Teams.Add(new Data.Team() { Name = "Test Team"}); TeamController teamController = new TeamController(_teamRepository, _assessmentRepo, _dimensionRepo); Core.Models.Team newTeam = new Core.Models.Team() { Name = _mockContainer.Teams.First().Name }; teamController.Post(newTeam); Assert.Fail("Must not create duplicate teams"); }
public void TestThatCreatingANewTeamIsAllowed() { TeamController teamController = new TeamController(_teamRepository, _assessmentRepo, _dimensionRepo); teamController.Request = _request; Core.Models.Team newTeam = new Core.Models.Team() { Name = Guid.NewGuid().ToString() }; IHttpActionResult result = teamController.Post(newTeam); //Assert.IsTrue(result.StatusCode == System.Net.HttpStatusCode.Created); Assert.IsTrue(_mockContainer.Teams.Where(i => i.Name == newTeam.Name).Count() == 1); }