Exemplo n.º 1
0
        public async Task GetTransactions()
        {
            try
            {
                notFound.IsVisible = true;
                notFound.Text      = "Loading...";

                var list = await _service.GetAllTransactions();

                _transactions = new ObservableCollection <Models.SellersModel.Transaction>(list);
                TransactionsListView.ItemsSource = _transactions;

                TransactionsListView.IsVisible = _transactions.Any();
                notFound.IsVisible             = !TransactionsListView.IsVisible;
            }
            catch (Exception)
            {
                await DisplayAlert("Error!",
                                   "Connection interrupted. Please check your network status, refresh the page or try again later.",
                                   "OK");
            }
            finally
            {
                notFound.Text = "No items found.";
            }
        }
Exemplo n.º 2
0
        public void GetAllTransactionsTest()
        {
            var clientServiceMock         = Substitute.For <IClientService>();
            var sharesServiceMock         = Substitute.For <ISharesService>();
            var portfolioServiceMock      = Substitute.For <IPortfoliosService>();
            var transactionRepositoryMock = Substitute.For <ITransactionsRepository>();

            var sut = new TransactionsService(
                clientServiceMock,
                sharesServiceMock,
                portfolioServiceMock,
                transactionRepositoryMock);

            // Act
            sut.GetAllTransactions();

            // Asserts
            transactionRepositoryMock.Received(1).GetAllTransactions();
        }