public void GetLastChunkShouldResetTestResultsInCache() { long cacheSize = 10; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); for (var i = 0; i < 2; i++) { var tr = this.GetTestResult(i); cache.OnNewTestResult(tr); } cache.GetLastChunk(); Assert.AreEqual(0, cache.TestResults.Count); }
public void GetLastChunkShouldReturnTestResultsInCache() { long cacheSize = 10; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); List <Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> pushedTestResults = new List <Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult>(); for (var i = 0; i < 2; i++) { var tr = this.GetTestResult(i); cache.OnNewTestResult(tr); pushedTestResults.Add(tr); } var testResultsInCache = cache.GetLastChunk(); CollectionAssert.AreEqual(pushedTestResults, testResultsInCache.ToList()); }