Created
April 6, 2016 10:43
-
-
Save tonysneed/c959954fb57f8490c1ddecc2e30cc00d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using HelloMvcWithDI.Entities; | |
using HelloMvcWithDI.Patterns; | |
namespace HelloMvcWithDI.Tests | |
{ | |
public class FakeProductRepository : IProductRepository | |
{ | |
private List<Product> _products = new List<Product> | |
{ | |
new Product | |
{ | |
Id = 1, | |
ProductName = "Espresso", | |
Price = 10 | |
}, | |
new Product | |
{ | |
Id = 2, | |
ProductName = "Capuccino", | |
Price = 20 | |
}, | |
new Product | |
{ | |
Id = 3, | |
ProductName = "Latte", | |
Price = 30 | |
}, | |
}; | |
public async Task<IEnumerable<Product>> GetProducts() | |
{ | |
return await Task.FromResult(_products); | |
} | |
public async Task<Product> GetProduct(int id) | |
{ | |
return await Task.FromResult(_products[id - 1]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment