コード例 #1
0
        public async Task Should_return_not_found_when_deleting_non_existent_aad_user()
        {
            const string CONTACT_EMAIL = EmailData.NON_EXISTENT_CONTACT_EMAIL;

            UserApiService.Setup(x => x.CheckUserExistsInAAD(CONTACT_EMAIL)).Returns(Task.FromResult(false));

            var result = await Controller.DeleteADUser(CONTACT_EMAIL);

            result.Should().NotBeNull();
            var objectResult = (NotFoundObjectResult)result;

            objectResult.StatusCode.Should().Be((int)HttpStatusCode.NotFound);
        }
コード例 #2
0
        public async Task Should_return_not_found_for_non_existent_email()
        {
            const string CONTACT_EMAIL = "*****@*****.**";

            UserApiService
            .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>()))
            .ReturnsAsync(false);

            var response = await Controller.DeleteADUser(CONTACT_EMAIL);

            response.Should().NotBeNull();

            var result = (ObjectResult)response;

            result.StatusCode.Should().Be((int)HttpStatusCode.NotFound);
        }
コード例 #3
0
        public async Task Should_delete_aad_user()
        {
            const string CONTACT_EMAIL = EmailData.NON_EXISTENT_CONTACT_EMAIL;

            var userProfile = Builder <UserProfile> .CreateNew().Build();

            userProfile.Email = CONTACT_EMAIL;

            UserApiService.Setup(x => x.CheckUserExistsInAAD(CONTACT_EMAIL)).Returns(Task.FromResult(true));
            UserApiService.Setup(x => x.DeleteUserInAAD(CONTACT_EMAIL)).Returns(Task.CompletedTask);

            var result = await Controller.DeleteADUser(CONTACT_EMAIL);

            result.Should().NotBeNull();
            var objectResult = (NoContentResult)result;

            objectResult.StatusCode.Should().Be((int)HttpStatusCode.NoContent);
        }
        public async Task Should_return_false_not_found_for_non_existent_user()
        {
            const string CONTACT_EMAIL = EmailData.NON_EXISTENT_CONTACT_EMAIL;

            UserApiService
            .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>()))
            .ReturnsAsync(false);

            var result = await Controller.GetUserExistsInAd(CONTACT_EMAIL);

            result.Should().NotBeNull();
            var objectResult = (ObjectResult)result;

            objectResult.StatusCode.Should().Be((int)HttpStatusCode.NotFound);

            var userExists = (bool)objectResult.Value;

            userExists.Should().BeFalse();
        }
        public async Task Should_get_existing_user_and_return_true()
        {
            const string CONTACT_EMAIL = EmailData.EXISTING_CONTACT_EMAIL;

            UserApiService
            .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>()))
            .ReturnsAsync(true);

            var result = await Controller.GetUserExistsInAd(CONTACT_EMAIL);

            result.Should().NotBeNull();
            var objectResult = (OkObjectResult)result;

            objectResult.StatusCode.Should().Be((int)HttpStatusCode.OK);

            var userExists = (bool)objectResult.Value;

            userExists.Should().BeTrue();
        }
コード例 #6
0
        public async Task Should_delete_hearing()
        {
            const string CONTACT_EMAIL = "*****@*****.**";

            UserApiService
            .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>()))
            .ReturnsAsync(true);

            UserApiService
            .Setup(x => x.DeleteUserInAAD(It.IsAny <string>()))
            .Returns(Task.CompletedTask);

            var response = await Controller.DeleteADUser(CONTACT_EMAIL);

            response.Should().NotBeNull();

            var result = (NoContentResult)response;

            result.StatusCode.Should().Be((int)HttpStatusCode.NoContent);
        }