public void ValidateWallet_NullCurrency_ThrowException()
        {
            var wallet = new Wallet
            {
                Name = "Test name",
                Currency = null
            };

            var walletService = new WalletService(ProvidersFactory.GetNewWalletsProviders());
            walletService.Validate(wallet);
        }
        public void ValidateWallet_EmptyName_ThrowException()
        {
            var wallet = new Wallet
            {
                Name = string.Empty,
                Currency = new Currency()
            };

            var walletService = new WalletService(ProvidersFactory.GetNewWalletsProviders());
            walletService.Validate(wallet);
        }
        public async Task<DeletedEntity<Wallet>> DeteleAsync(Wallet entity)
        {
            var walletToDelete = entity.Guid == Guid.Empty
                ? null
                : await Wallets.FindAsync(entity.Guid);

            walletToDelete.WalletAccessRights.Clear();
            var deletedWallet = walletToDelete == null
                ? null
                : Wallets.Remove(walletToDelete);

            await this.SaveChangesAsync();
            return new DeletedEntity<Wallet>(deletedWallet);
        }
        public async Task<bool> AddOrUpdateAsync(Wallet entity)
        {
            if (entity == null)
                throw new ArgumentNullException(nameof(entity));

            var existingWallet = entity.Guid == Guid.Empty
                ? null
                : await Wallets.FindAsync(entity.Guid);

            Wallets.AddOrUpdate(x => x.Guid, entity);

            await this.SaveChangesAsync();
            return existingWallet == null;
        }
        public void ValidateWallet_ValidWallet_ReturnTrue()
        {
            var wallet = new Wallet
            {
                Name = "Test name",
                Currency = new Currency
                {
                    Name = "Default currency",
                    Code = "DC",
                    Symbol = "C"
                }
            };

            var walletService = new WalletService(ProvidersFactory.GetNewWalletsProviders());
            Assert.DoesNotThrow(() => walletService.Validate(wallet));
        }
 public Task<bool> AddOrUpdateAsync(Wallet entity)
 {
     throw new NotImplementedException();
 }
 public Task<DeletedEntity<Wallet>> DeteleAsync(Wallet entity)
 {
     throw new NotImplementedException();
 }
 public async Task<DeletedEntity<Wallet>> DeteleAsync(Wallet entity)
 {
     await Task.CompletedTask;
     return new DeletedEntity<Wallet>(null);
 }
 public async Task<bool> AddOrUpdateAsync(Wallet entity)
 {
     await Task.CompletedTask;
     return false;
 }
 public void ValidateWallet_NullWallet_ThrowException(Wallet wallet)
 {
     var walletService = new WalletService(ProvidersFactory.GetNewWalletsProviders());
     walletService.Validate(wallet);
 }