Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Created April 6, 2016 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonysneed/c959954fb57f8490c1ddecc2e30cc00d to your computer and use it in GitHub Desktop.
Save tonysneed/c959954fb57f8490c1ddecc2e30cc00d to your computer and use it in GitHub Desktop.
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