public async Task GetAll_WhenUserExists_ReturnPayments() { var payments = new[] { new Payment { Amount = 10, CorrespondentUserId = 4, Date = new DateTime(2019, 05, 01), PaymentId = 1, UserId = UserFactory.CurrentUserId }, new Payment { Amount = 20, CorrespondentUserId = 3, Date = new DateTime(2019, 04, 01), PaymentId = 2, UserId = UserFactory.CurrentUserId } }; paymentServiceMock .Setup(mock => mock.GetAllByUserIdAsync(It.Is <int>(v => v.Equals(UserFactory.CurrentUserId)))) .ReturnsAsync(payments); var result = await paymentController.GetAll(paymentServiceMock.Object); var createdResult = result as OkObjectResult; Assert.NotNull(createdResult); Assert.AreEqual(200, createdResult.StatusCode); }
private async Task LoadPayments() { UseWaitCursor = true; PaymentController paymentController = Program.DI.Resolve <PaymentController>(); Payments = await(MyPaymentsOnlyFilter.Checked ? paymentController.GetByCreator(session.id) : paymentController.GetAll()); UseWaitCursor = false; }