public async Task GetAllTest() { var purchases = new List <Purchase>(); purchases.Add(purchase); IEnumerable <Purchase> purchaseList = purchases; purchaseService.Setup(t => t.GetPurchases()).Returns(Task.Run(() => purchaseList)); var result = await purchaseController.GetAll(purchaseService.Object); Assert.That(result, Is.InstanceOf <IActionResult>()); var ok = result; Assert.That(ok, Is.Not.Null); }