public void GetAddress_AddResultToCacheTrue_CalculateAddressIsNotCalled()
        {
            IntPtr expected = new IntPtr(4);
            TestCachedNamedOffsetProvider provider = new TestCachedNamedOffsetProvider();
            provider.ReturnValue = expected;
            provider.AddResultToCache = true;
            provider.GetAddress("cached");
            provider.CalculateAddressWasCalled = false;

            IntPtr actual = provider.GetAddress("cached");

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(provider.CalculateAddressWasCalled);
        }
        public void CanResolve_AddResultToCacheTrue_ReturnsTrue()
        {
            TestCachedNamedOffsetProvider provider = new TestCachedNamedOffsetProvider();
            provider.AddResultToCache = true;
            provider.GetAddress("cached");
            provider.CalculateAddressWasCalled = false;

            Assert.IsTrue(provider.CanResolve("cached"));
        }
        public void GetAddress_NotCached_CalculateAddressIsCalled()
        {
            IntPtr expected = new IntPtr(4);
            TestCachedNamedOffsetProvider provider = new TestCachedNamedOffsetProvider();
            provider.ReturnValue = expected;

            IntPtr actual = provider.GetAddress("not cached");

            Assert.AreEqual(expected, actual);
            Assert.IsTrue(provider.CalculateAddressWasCalled);
        }