public void ThrowArgumentNullException_WhenILogFilePathDiscoveryStrategyIsNull() { // Arrange var commandParsingStrategy = new Mock<ICommandParsingStrategy>(); var commandUtilizationStrategy = new Mock<ICommandUtilizationStrategy>(); ILogFilePathDiscoveryStrategy logFilePathDiscoveryStrategy = null; var fileReaderAutoResetEventFactory = new Mock<IFileReaderAutoResetEventFactory>(); var fileReaderFileSystemWatcherFactory = new Mock<IFileReaderFileSystemWatcherFactory>(); var fileReaderInputProviderFactory = new Mock<IFileReaderInputProviderFactory>(); // Act & Assert Assert.That( () => new LogFileReaderEngine(commandParsingStrategy.Object, commandUtilizationStrategy.Object, logFilePathDiscoveryStrategy, fileReaderAutoResetEventFactory.Object, fileReaderFileSystemWatcherFactory.Object, fileReaderInputProviderFactory.Object), Throws.InstanceOf<ArgumentNullException>().With.Message.Contains(nameof(ILogFilePathDiscoveryStrategy))); }
public LogFileReaderEngine(ICommandParsingStrategy commandParsingStrategy, ICommandUtilizationStrategy commandUtilizationStrategy, ILogFilePathDiscoveryStrategy logFilePathDiscoveryStrategy, IFileReaderAutoResetEventFactory fileReaderAutoResetEventFactory, IFileReaderFileSystemWatcherFactory fileReaderFileSystemWatcherFactory, IFileReaderInputProviderFactory fileReaderInputProviderFactory) { Guard.WhenArgument(commandParsingStrategy, nameof(ICommandParsingStrategy)).IsNull().Throw(); Guard.WhenArgument(commandUtilizationStrategy, nameof(ICommandUtilizationStrategy)).IsNull().Throw(); Guard.WhenArgument(logFilePathDiscoveryStrategy, nameof(ILogFilePathDiscoveryStrategy)).IsNull().Throw(); Guard.WhenArgument(fileReaderAutoResetEventFactory, nameof(IFileReaderAutoResetEventFactory)).IsNull().Throw(); Guard.WhenArgument(fileReaderFileSystemWatcherFactory, nameof(IFileReaderFileSystemWatcherFactory)).IsNull().Throw(); Guard.WhenArgument(fileReaderInputProviderFactory, nameof(IFileReaderInputProviderFactory)).IsNull().Throw(); this.commandParsingStrategy = commandParsingStrategy; this.commandUtilizationStrategy = commandUtilizationStrategy; this.logFilePathDiscoveryStrategy = logFilePathDiscoveryStrategy; this.fileReaderAutoResetEventFactory = fileReaderAutoResetEventFactory; this.fileReaderFileSystemWatcherFactory = fileReaderFileSystemWatcherFactory; this.fileReaderInputProviderFactory = fileReaderInputProviderFactory; }
public EnumeratingLogFileReaderEngine(ICommandParsingStrategy commandParsingStrategy, IForceCommandUtilizationStrategy forceCommandUtilizationStrategy, ILogFilePathDiscoveryStrategy logFilePathDiscoveryStrategy, IFileReaderAutoResetEventFactory fileReaderAutoResetEventFactory, IFileReaderFileSystemWatcherFactory fileReaderFileSystemWatcherFactory, IFileReaderInputProviderFactory fileReaderInputProviderFactory) : base(commandParsingStrategy, forceCommandUtilizationStrategy, logFilePathDiscoveryStrategy, fileReaderAutoResetEventFactory, fileReaderFileSystemWatcherFactory, fileReaderInputProviderFactory) { this.forceCommandUtilizationStrategy = forceCommandUtilizationStrategy; }