Пример #1
0
        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);
            }
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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);
        }