public void GetCacherTest() { var cf = new MemoryCacherFactory(new StubCachePolicyFactory(), new ObjectCacheFactory()); var ph = new PropertyHelper(cf); var tci = new TestClassImpl { I = 1 }; var tc = new TestClass { I = 2 }; var r1 = ph.Get(tci.GetType().GetProperty("I"), tci); var r2 = ph.Get(tc.GetType().GetProperty("I"), tc); Assert.AreEqual(tci.I, r1); Assert.AreEqual(tc.I, r2); }
public void CreateTest() { var res = new MemoryCacherFactory(_policyFactory.Object, _objCacheFactory.Object).Create<string>(); Assert.IsNotNull(res); Assert.AreEqual(typeof (MemoryCacher<string>), res.GetType()); }
public void SetCacherTest() { var cf = new MemoryCacherFactory(new StubCachePolicyFactory(), new ObjectCacheFactory()); var ph = new PropertyHelper(cf); var tci = new TestClassImpl(); var tc = new TestClass(); ph.Set(tci.GetType().GetProperty("I"), tci, 1); ph.Set(tc.GetType().GetProperty("I"), tc, 2); Assert.AreEqual(tci.I, 1); Assert.AreEqual(tc.I, 2); }