コード例 #1
0
        public async Task DeletePassword_Success()
        {
            //Arrange
            var users             = FakeModelsRepository.GetFakeUsers();
            var passwords         = FakeModelsRepository.GetFakePasswords();
            var dbContextMock     = MockInjectedServices.GetMockDbContext(users, passwords);
            var memoryCacheMock   = MockInjectedServices.GetMockmemoryCache(null);
            var authorizationMock = new Mock <IAuthorizationService>();

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

            //Act
            var result = await service.DeletePassword(new Guid(), new System.Security.Claims.ClaimsPrincipal(), cancellationToken);

            //Assert
            Assert.False(result.Success);
        }
コード例 #2
0
        public async Task GetPassword_PasswordNotFound()
        {
            //Arrange
            var users             = FakeModelsRepository.GetFakeUsers();
            var passwords         = FakeModelsRepository.GetFakePasswords();
            var dbContextMock     = MockInjectedServices.GetMockDbContext(users, passwords);
            var memoryCacheMock   = MockInjectedServices.GetMockmemoryCache(null);
            var authorizationMock = new Mock <IAuthorizationService>();

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

            //Act
            var result = await service.GetPassword(new Guid("6a2c050a-29f8-4bcb-8a70-9bccc2d57aad"),
                                                   FakeModelsRepository.UserExistLogin,
                                                   cancellationToken);

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