public void GetUser_TheUserDoesNotExist_ThrowNotFoundException()
        {
            _userManager.Setup(x => x.FindByIdAsync("userId")).ReturnsAsync((User)null);

            Assert.That(() => _sut.GetUser("userId", default),
                        Throws.TypeOf <NotFoundException>());
        }
Beispiel #2
0
        public async void FillDataAsync()
        {
            try
            {
                IsBusy = true;

                List <Error> errors = new List <Error>();
                await Task.WhenAll(
                    Task.Run(() =>
                {
                    GetUserService req = GetUserService.GetUser();

                    if (!req.IsSuccessful)
                    {
                        lock (errors)
                        {
                            errors.AddRange(req.Errors);
                        }
                        return;
                    }
                    User = req.User;
                    ServerManagement.GetInstance().User = req.User;
                }),
                    Task.Run(() =>
                {
                    ObservableCollection <TransactionModel> transactions = new ObservableCollection <TransactionModel>();

                    //TransactionService req = TransactionService.SearchTransaction();
                    //if (!req.IsSuccessful)
                    //{
                    //    lock (errors)
                    //    {
                    //        errors.AddRange(req.Errors);
                    //    }
                    //    return;
                    //}


                    //foreach (var item in req.Transactions)
                    //{
                    //    transactions.Add(item);
                    //}

                    TransactionService req = TransactionService.SearchTransactionPersonal();
                    if (!req.IsSuccessful)
                    {
                        lock (errors)
                        {
                            errors.AddRange(req.Errors);
                        }
                        return;
                    }

                    foreach (var item in req.Transactions)
                    {
                        transactions.Add(item);
                    }
                    lstTransfers = transactions;
                }));

                if (errors.Count > 0)
                {
                    ErrorHelper.ControlError(errors);
                }

                IsBusy = false;
            }
            catch (Exception ex)
            {
                IsBusy = false;
                ErrorHelper.ControlError(ex, false);
            }
        }