Exemplo n.º 1
0
 private static void AssertDirectories(RunConfiguration runConfiguration, string path)
 {
     foreach (var directoryResult in runConfiguration.CheckDirectories)
     {
         var dirPath = Path.Combine(path, directoryResult.Name);
         if (!directoryResult.Exists)
         {
             Directory.Exists(dirPath)
             .Should().BeFalse(because: $"Directory {directoryResult.Name} should not exist.");
         }
         else
         {
             Directory.Exists(dirPath)
             .Should().BeTrue(because: $"Directory {dirPath} should exist");
         }
     }
 }
Exemplo n.º 2
0
        private static void AssertFiles(RunConfiguration runConfiguration, string path)
        {
            foreach (var fileResult in runConfiguration.CheckFiles)
            {
                var filePath = Path.Combine(path, fileResult.Name);
                if (!fileResult.Exists)
                {
                    File.Exists(filePath)
                    .Should().BeFalse(because: $"File {fileResult.Name} should not exist.");
                }
                else
                {
                    File.Exists(filePath)
                    .Should().BeTrue(because: $"File {filePath} should exist");

                    var fileContent = File.ReadAllText(filePath);
                    if (!string.IsNullOrEmpty(fileResult.ContentIs))
                    {
                        fileContent
                        .Should()
                        .Be(fileResult.ContentIs, because: $"File ({fileResult.Name}) content should match ContentIs");
                    }

                    if (fileResult.ContentContains.Any())
                    {
                        fileContent
                        .Should()
                        .ContainAll(fileResult.ContentContains, because: $"File ({fileResult.Name}) content should contain all in ContentContains");
                    }

                    if (fileResult.ContentNotContains.Any())
                    {
                        fileContent
                        .Should()
                        .NotContainAny(fileResult.ContentNotContains, because: $"File ({fileResult.Name}) contains text from the noContain list");
                    }
                }
            }
        }
Exemplo n.º 3
0
 public static Task Run(RunConfiguration runConfiguration, ITestOutputHelper output = null, string workingDir = null, bool startHost = false) => Run(new[] { runConfiguration }, output, workingDir, startHost);
Exemplo n.º 4
0
 public static Task Run(RunConfiguration runConfiguration, ITestOutputHelper output = null) => Run(new[] { runConfiguration }, output);