A mock cache object for unit test classes to use which has the potential to snitch on strange cache behaviour.
Inheritance: ISwiffotronCache
Example #1
0
        /// <summary>
        /// Creates a swiffotron from the mock config profile and checks that everything is created
        /// correctly.
        /// </summary>
        /// <param name="mockStore">Returns a reference to the private store for testing.</param>
        /// <param name="htCache">Returns a reference to the private cache for testing.</param>
        /// <returns>A private accessor reference to the new Swiffotron.</returns>
        protected Swiffotron CreateMockSwiffotron(out MockStore mockStore, out MockCache htCache)
        {
#if(EXPRESS2010)
            Swiffotron swiffotron = new Swiffotron(ResourceAsStream(@"mock-config-express.xml"));
#else
            Swiffotron swiffotron = new Swiffotron(ResourceAsStream(@"mock-config.xml"));
#endif

            mockStore = (MockStore)swiffotron.conf_accessor.Stores.stores_accessor[@"store"];
            Assert.IsNotNull(mockStore, @"The store object was not created.");
            Assert.IsTrue(mockStore.InitialisedProperly, @"The store was not initialised properly");

            htCache = (MockCache)swiffotron.conf_accessor.Caches.caches_accessor[@"cache"];

            Assert.IsNotNull(htCache, @"The cache object was not created.");

            return swiffotron;
        }
Example #2
0
        /// <summary>
        /// Creates a swiffotron from the mock config profile and checks that everything is created
        /// correctly.
        /// </summary>
        /// <param name="mockStore">Returns a reference to the private store for testing.</param>
        /// <param name="htCache">Returns a reference to the private cache for testing.</param>
        /// <returns>A private accessor reference to the new Swiffotron.</returns>
        protected Swiffotron CreateMockSwiffotron(out MockStore mockStore, out MockCache htCache)
        {
#if (EXPRESS2010)
            Swiffotron swiffotron = new Swiffotron(ResourceAsStream(@"mock-config-express.xml"));
#else
            Swiffotron swiffotron = new Swiffotron(ResourceAsStream(@"mock-config.xml"));
#endif

            mockStore = (MockStore)swiffotron.conf_accessor.Stores.stores_accessor[@"store"];
            Assert.IsNotNull(mockStore, @"The store object was not created.");
            Assert.IsTrue(mockStore.InitialisedProperly, @"The store was not initialised properly");

            htCache = (MockCache)swiffotron.conf_accessor.Caches.caches_accessor[@"cache"];

            Assert.IsNotNull(htCache, @"The cache object was not created.");

            return(swiffotron);
        }