コード例 #1
0
        public void TestAddDirectoryFail()
        {
            _mockStore1.Setup(x => x.Contains(_digest1)).Returns(false);
            _mockStore2.Setup(x => x.Contains(_digest1)).Returns(false);

            _mockStore2.Setup(x => x.AddDirectory("path", _digest1, _handler)).Throws(new IOException("Fake IO exception for testing"));
            _mockStore1.Setup(x => x.AddDirectory("path", _digest1, _handler)).Throws(new IOException("Fake IO exception for testing"));
            _testStore.Invoking(x => x.AddDirectory("path", _digest1, _handler)).ShouldThrow <IOException>(because: "Should pass through fatal exceptions");
        }