Пример #1
0
        public ConsoleOutput(IConsole console, IVerboseOptions verboseOptions)
        {
            this.console = console ?? throw new ArgumentNullException(nameof(console));

            if (verboseOptions.Enabled)
            {
                Trace.Listeners.Add(new ConsoleOutputTraceListener(this));
            }
        }
        public void Writes_To_IConsoleOutput(
            IConsoleOutput console,
            IVerboseOptions options,
            uint progress)
        {
            var output = $"PROGRESS: {progress}%";

            new ProgressReporter(console, options).Progress(progress);
            Mock.Get(console)
            .Verify(expression: c => c.WriteLine(output));
        }
 public ProgressReporter(IConsoleOutput console, IVerboseOptions verboseOptions)
 {
     this.console        = console ?? throw new ArgumentNullException(nameof(console));
     this.verboseOptions = verboseOptions ?? throw new ArgumentNullException(nameof(verboseOptions));
 }
 public void Requires_IConsoleOutput(IVerboseOptions options)
 => new Action(() => new ProgressReporter(null, options))
 .Should()
 .ThrowExactly <ArgumentNullException>();