HandleFileAccess() private method

private HandleFileAccess ( System.Action loadFile, string fileName ) : bool
loadFile System.Action
fileName string
return bool
コード例 #1
0
        public void HandleFileAccess_SuppliedActionThrows_Exception_ReturnsException()
        {
            // arrange
            var persistence = new FilePersistance(_mockCommandLine.Object, _mockLogger.Object);

            // act
            var expected = new Exception();
            var actual = Assert.Throws<Exception>(() => persistence.HandleFileAccess(() => { throw expected; }, "file_name"));

            // assert
            Assert.AreSame(expected, actual);
        }
コード例 #2
0
        public void HandleFileAccess_SuppliedActionThrows_Exception_ReturnsFalse(Type exception)
        {
            // arrange
            var persistence = new FilePersistance(_mockCommandLine.Object, _mockLogger.Object);

            // act
            Assert.IsFalse(persistence.HandleFileAccess(() => { throw (Exception) Activator.CreateInstance(exception); }, "file_name"));
        }
コード例 #3
0
        public void HandleFileAccess_SuppliedActionSuccess_ReturnsTrue()
        {
            // arrange
            var persistence = new FilePersistance(_mockCommandLine.Object, _mockLogger.Object);

            // act
            Assert.IsTrue(persistence.HandleFileAccess(() => { }, "file_name"));
        }