public void TestPostTeam()
        {
            var controller = new TeamController(new RiskAntwerpRest_dbContext());

            controller.ModelState.AddModelError("", "dummy error");

            var actionResult = controller.AddTeam(new Teams());

            actionResult.Should().BeOfType <OkObjectResult>();
        }
예제 #2
0
        public void AddNewTeamReturnNewTeam()
        {
            // Arrange
            var team = new Team("Test Team");

            logic.Setup(l => l.AddTeam(team)).Returns(AddMockTeam(team));

            // Act
            var result = controller.AddTeam(team);

            // Assert
            Assert.IsType <CreatedResult>(result);
            var created = (CreatedResult)result;

            new Guid(created.Location);
            Assert.Equal("Test Team", team.ToString());
        }