public void CountTest() { DataObjectFactory DOFactory = new DataObjectFactory(_DAL); ObjectCache target = new ObjectCache(DOFactory); target.GetByID<SaleDO>(1); Assert.Equal(1, target.Count); var tempSale = new SaleDO { rowID = 2 }; target.Add( tempSale, ObjectCache.AddBehavior.THROWEXCEPTION); Assert.Equal(2, target.Count); target.Remove(tempSale); Assert.Equal(1, target.Count); //target.Clear(); //Assert.AreEqual(0, target.Count); }
public void GetByIDTest() { ObjectCache target = new ObjectCache(_DOFactory); Assert.Null( target.GetByID(1)); //GetByID with a type argument should return an object and added it to the cache SaleDO tempSale = target.GetByID<SaleDO>(1) as SaleDO; Assert.NotNull(tempSale); Assert.NotNull(target.GetByID(1)); }