Esempio n. 1
0
        /// <summary>
        /// Configures the engine to use an in-memory cache for testing
        /// </summary>
        public static BuildXLEngine ConfigureInMemoryCache(this BuildXLEngine engine, TestCache testCache = null)
        {
            if (engine.TestHooks == null)
            {
                engine.TestHooks = new EngineTestHooksData();
            }

            if (testCache != null)
            {
                engine.TestHooks.CacheFactory = (context) =>
                {
                    return(new EngineCache(
                               testCache.GetArtifacts(context),
                               testCache.Fingerprints));
                };
            }
            else
            {
                engine.TestHooks.CacheFactory = (context) =>
                {
                    return(new EngineCache(
                               new InMemoryArtifactContentCache(context),
                               new InMemoryTwoPhaseFingerprintStore()));
                };
            }

            return(engine);
        }