Flush() public method

public Flush ( ) : void
return void
コード例 #1
0
        public void TestContainsCache()
        {
            // First have underlying store report true
            _mockStore1.Setup(x => x.Contains(_digest1)).Returns(true);
            Assert.IsTrue(_testStore.Contains(_digest1));

            // Then check the composite cached the result
            _mockStore1.Setup(x => x.Contains(_digest1)).Throws(new AssertionException("Should not call underlying store when result is cached"));
            Assert.IsTrue(_testStore.Contains(_digest1));

            // Then clear cache and report different result
            _testStore.Flush();
            _mockStore1.Setup(x => x.Contains(_digest1)).Returns(false);
            _mockStore2.Setup(x => x.Contains(_digest1)).Returns(false);
            Assert.IsFalse(_testStore.Contains(_digest1));
        }