Ejemplo n.º 1
0
        public async Task AddPassword_NotFoundUser()
        {
            //Arrange
            var users             = FakeModelsRepository.GetFakeUsers();
            var dbContextMock     = MockInjectedServices.GetMockDbContext(users);
            var memoryCacheMock   = MockInjectedServices.GetMockmemoryCache(null);
            var authorizationMock = new Mock <IAuthorizationService>();

            var service           = new WalletService(dbContextMock.Object, memoryCacheMock.Object, authorizationMock.Object);
            var addPasswordModel  = FakeModelsRepository.GetFakeAddNewPasswordModel();
            var cancellationToken = new CancellationToken();

            //Act
            var result = await service.AddNewPassowrd(addPasswordModel, FakeModelsRepository.UserNotExistLogin, cancellationToken);

            //Assert
            Assert.False(result.Success);
        }
Ejemplo n.º 2
0
        public async Task AddPassword_Successfull()
        {
            //Arrange
            var users         = FakeModelsRepository.GetFakeUsers();
            var dbContextMock = MockInjectedServices.GetMockDbContext(users);

            object expectedValue     = HashHelper.SHA512("zdRpf^%f65V(0" + "testSALT" + "Password");
            var    memoryCacheMock   = MockInjectedServices.GetMockmemoryCache(expectedValue);
            var    authorizationMock = new Mock <IAuthorizationService>();

            var service           = new WalletService(dbContextMock.Object, memoryCacheMock.Object, authorizationMock.Object);
            var addPasswordModel  = FakeModelsRepository.GetFakeAddNewPasswordModel();
            var cancellationToken = new CancellationToken();

            //Act
            var result = await service.AddNewPassowrd(addPasswordModel, FakeModelsRepository.UserExistLogin, cancellationToken);

            //Assert
            Assert.True(result.Success);
        }