예제 #1
0
        public async Task Given_Invalid_OrganisationName_Or_TeamName_When_Call_DeleteTeamAsync_ShouldReturns_BadRequest(string organisationName, string teamName)
        {
            var controller = new WebAPI.Controllers.TeamController();
            var result     = await controller.DeleteTeamAsync(organisationName, teamName, null, null);

            Assert.IsType <BadRequestObjectResult>(result);
        }
예제 #2
0
        public async Task Given_Valid_OrganisationService_And_OrganisationName_And_TeamName_When_Call_DeleteTeamAsync_ShouldReturns_OkObjectResult_And_TeamInstance(string organisationName, string teamName)
        {
            var moqService = new Mock <ITeamService>();

            moqService
            .Setup(t => t.DeleteAsync(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            var controller = new WebAPI.Controllers.TeamController();
            var result     = await controller.DeleteTeamAsync(organisationName, teamName, null, moqService.Object);

            moqService.Verify();
            Assert.IsType <NoContentResult>(result);
        }
예제 #3
0
        public async Task Given_Invalid_OrganisationService_When_Call_DeleteTeamAsync_ShouldReturns_InternalServerError(string organisationName, string teamName)
        {
            var moqService = new Mock <ITeamService>();

            moqService
            .Setup(t => t.DeleteAsync(It.IsAny <string>(), It.IsAny <string>()))
            .Throws <Exception>()
            .Verifiable();

            var controller = new WebAPI.Controllers.TeamController();
            var result     = await controller.DeleteTeamAsync(organisationName, teamName, null, moqService.Object);

            moqService.Verify();
            Assert.IsType <StatusCodeResult>(result);
            var internalServerError = (StatusCodeResult)result;

            Assert.NotNull(internalServerError);
            Assert.Equal((int)HttpStatusCode.InternalServerError, internalServerError.StatusCode);
        }