コード例 #1
0
        public virtual void AddWithNoSetUp_TestObject_AddInvokedOnce()
        {
            var cacheEntryKey  = "SomethingInTheCache";
            var expectedResult = new TestObject();

            MockedCache.Set(cacheEntryKey, expectedResult);

            MockedCache.Received(1).CreateEntry(cacheEntryKey);
        }
コード例 #2
0
        public virtual void AddThenGetWithNoSetUp_TestObject_GetInvokedOnce()
        {
            var cacheEntryKey  = "SomethingInTheCache";
            var expectedResult = new TestObject();

            MockedCache.Set(cacheEntryKey, expectedResult);

            var actualResult = MockedCache.Get <TestObject>(cacheEntryKey);

            object value;

            MockedCache.Received(1).TryGetValue(cacheEntryKey, out value);
        }