Example #1
0
        public void Execution_Cache_Test_Get_Returns_Empty_List_When_Not_Exists()
        {
            var executionCache = new ExecutionCache();
            var methods        = executionCache.GetMethods(1);

            Assert.IsTrue(methods != null);
            Assert.IsTrue(methods.Count == 0);
            executionCache.ClearCache();
        }
Example #2
0
        public void Execution_Cache_Test_No_Access_To_Diff_Thread()
        {
            var method         = TestClass.Method1EntryRecording;
            var executionCache = new ExecutionCache();

            executionCache.GetMethods(1).Add(method);

            var thread2Methods = executionCache.GetMethods(2);

            Assert.IsTrue(thread2Methods.Count == 0);
            executionCache.ClearCache();
        }
Example #3
0
        public void Execution_Cache_Test_Get_Returns_Val_When_Exists()
        {
            var method         = TestClass.Method1EntryRecording;
            var executionCache = new ExecutionCache();

            executionCache.GetMethods(1).Add(method);

            var method2 = executionCache.GetMethods(1);

            Assert.IsTrue(method2.Count > 0);
            executionCache.ClearCache();
        }
Example #4
0
        public void Execution_Cache_Test_Dif_Instance_Returns_Same_Value()
        {
            var method         = TestClass.Method1EntryRecording;
            var executionCache = new ExecutionCache();

            executionCache.GetMethods(1).Add(method);

            var executionCache2 = new ExecutionCache();
            var method2         = executionCache.GetMethods(1);

            Assert.IsTrue(method2.Count > 0);
            executionCache.ClearCache();
        }
Example #5
0
        public void Execution_Cache_Test_Modify_Method_Saves()
        {
            var method = TestClass.Method1EntryRecording;

            method.CloseOutMethodWithReturnVal("blah");
            var executionCache = new ExecutionCache();

            executionCache.GetMethods(1).Add(method);

            var method2 = executionCache.GetMethods(1);

            Assert.IsTrue(method2.FirstOrDefault().IsExecutionComplete);
            executionCache.ClearCache();
        }
Example #6
0
        // Creates one if it doesn't exist
        public IExecutionCache Get(IModule module, Engine engine)
        {
            if (_noCache)
            {
                return new NoCache();
            }

            ExecutionCache cache;
            if (!_executionCaches.TryGetValue(module, out cache))
            {
                cache = new ExecutionCache(engine);
                _executionCaches.Add(module, cache);
            }
            return cache;
        }
Example #7
0
        public void Execution_Cache_Test_Clear_Cache_Empties_Methods()
        {
            var method         = TestClass.Method1EntryRecording;
            var executionCache = new ExecutionCache();

            executionCache.GetMethods(1).Add(method);

            var methods = executionCache.GetMethods(1);

            Assert.IsTrue(methods.Count == 1);

            executionCache.ClearCache();
            methods = executionCache.GetMethods(1);
            Assert.IsTrue(methods.Count == 0);
        }