Пример #1
0
        public void TestCacheViaConfig()
        {
            IServiceB serviceB = _container[typeof(IServiceB)] as IServiceB;

            // MethodeA
            FifoCacheManager fifoCacheManager = _container["Another.Cache"] as FifoCacheManager;

            Assert.IsTrue(fifoCacheManager.KeyList.Count == 0);

            serviceB.MyMethodA("cache", "serviceB", "MyMethodA");
            string consoleContents = _outWriter.GetStringBuilder().ToString();

            Assert.IsTrue(fifoCacheManager.KeyList.Count == 1);

            serviceB.MyMethodA("cache", "serviceB", "MyMethodA");
            Assert.AreEqual(consoleContents, _outWriter.GetStringBuilder().ToString());

            // MethodeB
            ResetConsoleOut();

            serviceB.MyMethodB();
            consoleContents = _outWriter.GetStringBuilder().ToString();

            serviceB.MyMethodB();
            Assert.AreEqual(consoleContents, _outWriter.GetStringBuilder().ToString());
        }