public async System.Threading.Tasks.Task GetCategoriesAsync_NotInCache_GetCategoriesFromDatabase() { //Arrange NorthwindDbContext stubNorthwindDBContext = StubDbContext.GetContextWithData(); FakeCache fakeCache = new FakeCache(false); MockLogger mockLogger = new MockLogger(); NorthwindDAL northwindDAL = new NorthwindDAL(stubNorthwindDBContext, fakeCache, mockLogger); //Act IList <Category> Categories = await northwindDAL.GetCategoriesAsync(); //Assert Assert.IsTrue(mockLogger.DidLog("##Start## GetCategories from database.")); }
public async System.Threading.Tasks.Task GetCategoriesAsync_InCache_GetCategoriesFromCacheAsync() { //Arrange NorthwindDbContext stubNorthwindDBContext = StubDbContext.GetContextWithData(); FakeCache fakeCache = new FakeCache(true); //fakeCache.Set("", "categories"); MockLogger mockLogger = new MockLogger(); NorthwindDAL northwindDAL = new NorthwindDAL(stubNorthwindDBContext, fakeCache, mockLogger); //Act IList <Category> Categories = await northwindDAL.GetCategoriesAsync(); //Assert //Assert.IsNotNull(Categories); Assert.IsTrue(mockLogger.DidLog("##Start## GetCategories from cache.")); }
public AdminController(NorthwindDbContext northwindCtx, IMemoryCache memoryCache, ILogger <HomeController> logger) { _logger = logger; _NorthwindDAL = new NorthwindDAL(northwindCtx, memoryCache, _logger); }
public HomeController(NorthwindDbContext northwindCtx, IMemoryCache memoryCache, ILogger <HomeController> logger) { //_db = injectedContext; _logger = logger; _NorthwindDAL = new NorthwindDAL(northwindCtx, memoryCache, _logger); }
public async Task <IEnumerable <CustomerList> > Get() { var dal = new NorthwindDAL(); return(await dal.GetAllCustomers()); }