コード例 #1
0
        public async Task LogsDeleted_When_NoLogsExist()
        {
            // Arrange
            var logs = LogFactory.CreateEmpty();

            _logRepositoryMock.Setup(x => x.GetAllAsync()).Returns(Task.FromResult(logs));

            var exceptionLogDumpCreator = new DistributeLogDumpCreator(
                _logRepositoryMock.Object,
                _dateTimeProvider.Object,
                _fileProvider.Object,
                _directoryProvider.Object,
                _pathProvider.Object,
                _consoleProvider.Object,
                _reflectionProvider.Object);

            // Act
            await exceptionLogDumpCreator.DeleteAllDumpsAsync();

            // Assert
            await exceptionLogDumpCreator.DeleteAllDumpsAsync();
        }
コード例 #2
0
        public async Task LogsDeleted_When_OneLogExists()
        {
            // Arrange
            var logs = LogFactory.Create(1);

            _logRepositoryMock.Setup(x => x.GetAllAsync()).Returns(Task.FromResult(logs));
            var exceptionLogDumpCreator = new DistributeLogDumpCreator(
                _logRepositoryMock.Object,
                _dateTimeProvider.Object,
                _fileProvider.Object,
                _directoryProvider.Object,
                _pathProvider.Object,
                _consoleProvider.Object,
                _reflectionProvider.Object);

            // Act
            exceptionLogDumpCreator.DeleteAllDumpsAsync();

            // Assert
            _logRepositoryMock.Verify(x => x.DeleteAsync(logs), Times.AtLeastOnce);
        }