Example #1
0
    public void Send(IList <ScanResult> results, IOutputFormatter formatter, ScanCommandOptions options)
    {
        var path = Path.Combine(options.Path.FullName,
                                $"freshli-scan-{DateTime.Now:yyyyMMddTHHmmss}.{options.Format}");
        var file = File.CreateText(path);

        file.WriteLine(formatter.Format(results));
    }
    public void Send_MetricsResult_CallFormatterOnce(IOutputStrategy strategy)
    {
        var formatterMock = new Mock <IOutputFormatter>();
        var result        = new List <ScanResult>();
        // We cannot mock DirectoryInfo, so we need to provide a real path (pwd for running test will do)
        var options = new ScanCommandOptions {
            Path = new DirectoryInfo(".")
        };

        formatterMock.Setup(f => f.Format <ScanResult>(result)).Returns("formatted text");
        strategy.Send(result, formatterMock.Object, options);
        formatterMock.Verify(f => f.Format <ScanResult>(result), Times.Once());
    }
Example #3
0
        public virtual void Send(IList <ScanResult> results, IOutputFormatter formatter, ScanCommandOptions options)
        {
            string       path = Path.Combine(options.Path ?? string.Empty, $"freshli-scan-{DateTime.Now:yyyyMMddTHHmmss}.{options.Format}");
            StreamWriter file = File.CreateText(path);

            file.WriteLine(formatter.Format(results));
        }
Example #4
0
 public virtual void Send(IList <ScanResult> results, IOutputFormatter formatter, ScanCommandOptions options)
 {
     Console.WriteLine("Sending metrics to Console");
     Console.Out.WriteLine(formatter.Format(results));
 }
Example #5
0
 public void Send(IList <ScanResult> results, IOutputFormatter formatter, ScanCommandOptions options)
 {
     // ReSharper disable once LocalizableElement
     Console.WriteLine("Sending metrics to Console");
     Console.Out.WriteLine(formatter.Format(results));
 }