Ejemplo n.º 1
0
        public async Task Given_TeamName_And_Instance_TeamName_Is_Different_When_Call_UpdateTeamAsync_ShouldReturns_BadRequest(string organisationName, string teamName, string instanceTeamName)
        {
            var controller = new WebAPI.Controllers.TeamController();
            var result     = await controller.UpdateTeamAsync(organisationName, teamName, new DataContracts.Team {
                Name = instanceTeamName
            }, null, null);

            Assert.IsType <BadRequestObjectResult>(result);
        }
Ejemplo n.º 2
0
        public async Task Given_Invalid_TeamService_When_Call_UpdateTeamAsync_ShouldReturns_InternalServerError(string organisationName, string teamName, string instanceTeamName)
        {
            var controller = new WebAPI.Controllers.TeamController();
            var result     = await controller.UpdateTeamAsync(organisationName, teamName, new DataContracts.Team {
                Name = instanceTeamName
            }, null, null);

            Assert.IsType <StatusCodeResult>(result);
            var statusCodeResult = (StatusCodeResult)result;

            Assert.NotNull(statusCodeResult);
            Assert.Equal((int)HttpStatusCode.InternalServerError, statusCodeResult.StatusCode);
        }
Ejemplo n.º 3
0
        public async Task Given_TeamName_Is_Not_Registered_When_Call_UpdateTeamAsync_ShouldReturns_NotFound(string organisationName, string teamName, string instanceTeamName)
        {
            var moqService = new Mock <ITeamService>();

            moqService
            .Setup(t => t.UpdateAsync(It.IsAny <string>(), It.IsAny <DataContracts.Team>()))
            .ReturnsAsync(() => null)
            .Verifiable();

            var controller = new WebAPI.Controllers.TeamController();
            var result     = await controller.UpdateTeamAsync(organisationName, teamName, new DataContracts.Team {
                Name = instanceTeamName
            }, null, moqService.Object);

            moqService.Verify();

            Assert.IsType <NotFoundResult>(result);
        }