Exemple #1
0
        public void AddResultToCacheUncacheableResult()
        {
            Assert.IsNull(cacheScope.GetCacheEntry("TaskItems"), "Cache should not have an entry");
            NodeRequestMapping requestMapping = new NodeRequestMapping(1, 1, cacheScope);

            Assert.AreEqual(1, requestMapping.HandleId, "Expected NodeProxyId to be 1");
            Assert.AreEqual(1, requestMapping.RequestId, "Expected RequestId to be 1");
            requestMapping.AddResultToCache(uncacheableResult);
            Assert.IsNull(cacheScope.GetCacheEntry("TaskItems"),
                          "Expected null to be retrieved from the cache as the targetNamesList should not have been added");
        }
Exemple #2
0
        public void AddResultToCache()
        {
            Assert.IsNull(cacheScope.GetCacheEntry("TaskItems"), "Cache should not have an entry");
            NodeRequestMapping requestMapping = new NodeRequestMapping(1, 1, cacheScope);

            Assert.AreEqual(1, requestMapping.HandleId, "Expected NodeProxyId to be 1");
            Assert.AreEqual(1, requestMapping.RequestId, "Expected RequestId to be 1");
            requestMapping.AddResultToCache(resultWithOutputs);
            Assert.IsTrue(resultWithOutputs.EvaluationResult == ((BuildResultCacheEntry)cacheScope.GetCacheEntry("TaskItems")).BuildResult,
                          "Expected EvaluationResult to be the same after it was retrieved from the cache");
            Assert.IsTrue(((BuildItem[])resultWithOutputs.OutputsByTarget["TaskItems"])[0].Include == ((BuildResultCacheEntry)cacheScope.GetCacheEntry("TaskItems")).BuildItems[0].Include,
                          "Expected EvaluationResult to be the same after it was retrieved from the cache");
            // Remove the entry from the cache
            cacheScope.ClearCacheEntry("TaskItems");
        }
Exemple #3
0
        public void AddResultToCacheFailedResult()
        {
            Assert.IsNull(cacheScope.GetCacheEntry("TaskItems"), "Cache should not have an entry");
            NodeRequestMapping requestMapping = new NodeRequestMapping(1, 1, cacheScope);

            Assert.AreEqual(1, requestMapping.HandleId, "Expected NodeProxyId to be 1");
            Assert.AreEqual(1, requestMapping.RequestId, "Expected RequestId to be 1");
            requestMapping.AddResultToCache(failedResult);
            Assert.IsTrue(failedResult.EvaluationResult == ((BuildResultCacheEntry)cacheScope.GetCacheEntry("TaskItems")).BuildResult,
                          "Expected EvaluationResult to be the same after it was retrieved from the cache");
            Assert.IsNull(((BuildResultCacheEntry)cacheScope.GetCacheEntry("TaskItems")).BuildItems,
                          "Task items should not be cached for failed build results");
            // Remove the entry from the cache
            cacheScope.ClearCacheEntry("TaskItems");
        }