Exemple #1
0
        public void SendConfirmAccountEmailValidResult()
        {
            UserServiceMocker mocker = new UserServiceMocker();

            mocker.UserResolverServiceMock.Setup(r => r.GetUser()).Returns(() => Task.FromResult <UserModel>(new UserModel()));

            IUserBLService service = mocker.GetService();

            var result = service.SendConfirmAccountEmail();

            Assert.True(result.Result.IsOk);
            Assert.Equal(DateTime.Today.AddDays(30), result.Result.Content.ExpirationDate);
        }
Exemple #2
0
        public void SendConfirmAccountUnhandledException()
        {
            UserServiceMocker mocker = new UserServiceMocker();

            mocker.UserResolverServiceMock.Setup(r => r.GetUser()).Returns(() => Task.FromResult <UserModel>(new UserModel()));
            mocker.SystemCodeRepositoryMock.Setup(r => r.Commit()).Throws(new Exception("testexception"));

            IUserBLService service = mocker.GetService();

            var result = service.SendConfirmAccountEmail();

            Assert.Equal(ErrorStatus.InternalServer, result.Result.Error.Status);
            Assert.Equal("testexception", result.Result.Error.Message);
        }
Exemple #3
0
        public void SendConfirmAccountEmailnullUser()
        {
            UserServiceMocker mocker = new UserServiceMocker();

            mocker.RepoMock.Setup(r => r.GetSingle(It.IsAny <Expression <Func <UserEntity, bool> > >()))
            .Returns(() => Task.FromResult <UserEntity>(null));

            IUserBLService service = mocker.GetService();

            var result = service.SendConfirmAccountEmail();

            Assert.Equal(ErrorStatus.Forbidden, result.Result.Error.Status);
            Assert.Equal("User is not logged in", result.Result.Error.Message);
        }
Exemple #4
0
        public async Task <IActionResult> ConfirmAccount()
        {
            var result = await _userService.SendConfirmAccountEmail();

            return(WrapResponse(result, HttpStatusCode.OK));
        }