public void UserSalesService_SetHeader_Record_GetSales(string row, string record) { ICSVReader csvReader = new CSVReader(); MemoryCacheOptions options = new MemoryCacheOptions(); IMemoryCache cache = new MemoryCache(options); IDataCache dataCache = new UserSalesCache(); dataCache.SetCache(cache); IUserSalesService userSalesService = new UserSalesService(csvReader); userSalesService.UseCache(dataCache); userSalesService.SetHeader(row); userSalesService.Record(record); List <UserSalesModel> userSales = userSalesService.GetSales(null, null); Assert.AreEqual("John Doe", userSales[0].User_Name); }
public void UserSalesCache_Remove_Test() { MemoryCacheOptions options = new MemoryCacheOptions(); IMemoryCache cache = new MemoryCache(options); IDataCache dataCache = new UserSalesCache(); dataCache.SetCache(cache); IUserSales userSales = new UserSalesModel() { User_Name = "Renel Castro", }; string dateTime = DateTime.Now.ToString("YYYY-MM-dd"); dataCache.Create(userSales, DataCacheKey.Sales, DataCacheDuration.Short, dateTime); dataCache.Remove(DataCacheKey.Sales, dateTime); UserSalesModel userSalesCache = dataCache.Get <UserSalesModel>(DataCacheKey.Sales, dateTime); Assert.AreEqual(null, userSalesCache.User_Name); }