public void ShouldReorderInTopoOrder() { for (int i = 0; i < _numberOfRepeats; i++) { // Simulate thread that loads revisions from git var loadRevisionsTask = new Task(() => LoadRandomRevisions()); // Simulate thread that caches the rows in the background var buildCacheTask = new Task(() => BuildCache()); // Simulate thread that renders var renderTask = new Task(() => Render()); loadRevisionsTask.Start(); buildCacheTask.Start(); renderTask.Start(); Task.WaitAll(loadRevisionsTask, buildCacheTask, renderTask); // One last 'cache to', in case the loading of the revisions was finished after building the cache (unlikely) _revisionGraph.CacheTo(_revisionGraph.Count, _revisionGraph.Count); // Validate topo order Assert.IsTrue(_revisionGraph.GetTestAccessor().ValidateTopoOrder()); } }
public void ShouldBeAbleToCacheGraphTo() { Assert.AreEqual(0, _revisionGraph.GetCachedCount()); _revisionGraph.CacheTo(4, 2); Assert.AreEqual(3, _revisionGraph.GetCachedCount()); _revisionGraph.CacheTo(4, 4); Assert.AreEqual(5, _revisionGraph.GetCachedCount()); _revisionGraph.CacheTo(400, 400); Assert.AreEqual(6, _revisionGraph.GetCachedCount()); }
public void ShouldBeAbleToCacheGraphTo() { Assert.AreEqual(0, _revisionGraph.GetCachedCount()); _revisionGraph.CacheTo(4, 2); Assert.AreEqual(3, _revisionGraph.GetCachedCount()); _revisionGraph.CacheTo(4, 4); Assert.AreEqual(5, _revisionGraph.GetCachedCount()); _revisionGraph.CacheTo(400, 400); Assert.AreEqual(6, _revisionGraph.GetCachedCount()); _revisionGraph.LoadingCompleted(); Assert.AreEqual(6 + LookAhead, _revisionGraph.GetCachedCount()); }