示例#1
0
 public void testDependencies()
 {
     RefreshHelper helper = new RefreshHelper(null);
     MockRefreshable mock1 = new MockRefreshable();
     MockRefreshable mock2 = new MockRefreshable();
     helper.AddDependency(mock1);
     helper.AddDependency(mock2);
     helper.Refresh(null);
     Assert.AreEqual(1, mock1.getCallCount());
     Assert.AreEqual(1, mock2.getCallCount());
 }
示例#2
0
        public void testDependencies()
        {
            RefreshHelper   helper = new RefreshHelper(null);
            MockRefreshable mock1  = new MockRefreshable();
            MockRefreshable mock2  = new MockRefreshable();

            helper.AddDependency(mock1);
            helper.AddDependency(mock2);
            helper.Refresh(null);
            Assert.AreEqual(1, mock1.getCallCount());
            Assert.AreEqual(1, mock2.getCallCount());
        }
示例#3
0
 public void testAlreadyRefreshed()
 {
     RefreshHelper helper = new RefreshHelper(null);
     MockRefreshable mock1 = new MockRefreshable();
     MockRefreshable mock2 = new MockRefreshable();
     helper.AddDependency(mock1);
     helper.AddDependency(mock2);
     IList<IRefreshable> alreadyRefreshed = new List<IRefreshable>(1);
     alreadyRefreshed.Add(mock1);
     helper.Refresh(alreadyRefreshed);
     Assert.AreEqual(0, mock1.getCallCount());
     Assert.AreEqual(1, mock2.getCallCount());
 }
示例#4
0
        public void testAlreadyRefreshed()
        {
            RefreshHelper   helper = new RefreshHelper(null);
            MockRefreshable mock1  = new MockRefreshable();
            MockRefreshable mock2  = new MockRefreshable();

            helper.AddDependency(mock1);
            helper.AddDependency(mock2);
            IList <IRefreshable> alreadyRefreshed = new List <IRefreshable>(1);

            alreadyRefreshed.Add(mock1);
            helper.Refresh(alreadyRefreshed);
            Assert.AreEqual(0, mock1.getCallCount());
            Assert.AreEqual(1, mock2.getCallCount());
        }
 protected AbstractFactorizer(IDataModel dataModel) {
   this.dataModel = dataModel;
   buildMappings();
   refreshHelper = new RefreshHelper( () => {
       buildMappings();
     });
   refreshHelper.AddDependency(dataModel);
 }
 protected AbstractItemSimilarity(IDataModel dataModel) {
   //Preconditions.checkArgument(dataModel != null, "dataModel is null");
   this.dataModel = dataModel;
   this.refreshHelper = new RefreshHelper(null);
   refreshHelper.AddDependency(this.dataModel);
 }