示例#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."));
        }
示例#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."));
        }