public void TestOutOfBoundsExceptionWithStub()
        {
            using (ShimsContext.Create())
            {
                // Arrange.
                StubIMemoryModule memoryModule = new StubIMemoryModule();
                memoryModule.WriteInt64Object = (address, objToStore) =>
                    {
                        throw new AccessViolationException();
                    };
                CacheManager manager = new CacheManager(memoryModule);

                // Act.
                manager.Store("Test Object");
            }
        }
        public void TestCachingWithStub()
        {
            using (ShimsContext.Create())
            {
                // Arrange.
                StubIMemoryModule memoryModule = new StubIMemoryModule();
                object objectWritten = null;
                memoryModule.WriteInt64Object = (address, objectToWrite) =>
                    {
                        objectWritten = objectToWrite;
                    };
                memoryModule.ReadInt64 = (address) => objectWritten;
                CacheManager manager = new CacheManager(memoryModule);
                string myObj = "Test Object";

                // Act.
                manager.Store(myObj);
                object retrievedOjbect = manager.GetMostRecentCacheItem();

                // Assert.
                Assert.AreEqual(myObj, retrievedOjbect, "Retrieved object is not the same as stored.");
            }
        }