public async System.Threading.Tasks.Task testCartGetAsync() { var carts = new List <Cart> { new Cart() { Id = "test1" }, new Cart() { Id = "test2" }, }; var fakeRepositoryMock = new Mock <ICartsRepository>(); fakeRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(carts); var cartService = new CartsService(fakeRepositoryMock.Object); var resultCarts = await cartService.GetCarts(); Xunit.Assert.Collection(resultCarts, cart => { Xunit.Assert.Equal("test1", cart.Id); }, cart => { Xunit.Assert.Equal("test2", cart.Id); }); }