Ejemplo n.º 1
0
        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."));
        }
Ejemplo n.º 2
0
        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."));
        }
Ejemplo n.º 3
0
 public AdminController(NorthwindDbContext northwindCtx, IMemoryCache memoryCache, ILogger <HomeController> logger)
 {
     _logger       = logger;
     _NorthwindDAL = new NorthwindDAL(northwindCtx, memoryCache, _logger);
 }
Ejemplo n.º 4
0
 public HomeController(NorthwindDbContext northwindCtx, IMemoryCache memoryCache, ILogger <HomeController> logger)
 {
     //_db = injectedContext;
     _logger       = logger;
     _NorthwindDAL = new NorthwindDAL(northwindCtx, memoryCache, _logger);
 }
Ejemplo n.º 5
0
        public async Task <IEnumerable <CustomerList> > Get()
        {
            var dal = new NorthwindDAL();

            return(await dal.GetAllCustomers());
        }