public void OnTestCompletionShouldUpdateInProgressListWhenTestHasSameId() { long cacheSize = 2; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); for (var i = 0; i < cacheSize; i++) { var tr = this.GetTestResult(i); cache.OnTestStarted(tr.TestCase); var clone = new TestCase( tr.TestCase.FullyQualifiedName, tr.TestCase.ExecutorUri, tr.TestCase.Source); clone.Id = tr.TestCase.Id; Assert.IsTrue(cache.OnTestCompletion(clone)); Assert.AreEqual(0, cache.InProgressTests.Count); } }
public void OnTestCompletionShouldReturnFalseIfInProgressTestsIsEmpty() { long cacheSize = 10; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); Assert.IsFalse(cache.OnTestCompletion(this.GetTestResult(0).TestCase)); }
public void OnTestCompletionShouldNotThrowIfCompletedTestIsNull() { long cacheSize = 10; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); Assert.IsFalse(cache.OnTestCompletion(null)); }
public void OnTestCompletionShouldUpdateInProgressList() { long cacheSize = 2; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); for (int i = 0; i < cacheSize; i++) { var tr = this.GetTestResult(i); cache.OnTestStarted(tr.TestCase); Assert.IsTrue(cache.OnTestCompletion(tr.TestCase)); Assert.AreEqual(0, cache.InProgressTests.Count); } }
public void OnTestCompleteShouldNotRemoveTestCaseFromInProgressListForUnrelatedTestResult() { long cacheSize = 10; var tester = new TestCacheTester { ExpectedCacheSize = cacheSize }; var cache = new TestRunCache(cacheSize, TimeSpan.MaxValue, tester.CacheHitOnSize); var tr1 = this.GetTestResult(0); cache.OnTestStarted(tr1.TestCase); var tr2 = this.GetTestResult(1); Assert.IsFalse(cache.OnTestCompletion(tr2.TestCase)); Assert.AreEqual(1, cache.InProgressTests.Count); }