NUnit.Framework.FileAssert.Exists(string)

Here are the examples of the csharp api NUnit.Framework.FileAssert.Exists(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

28 Examples 7

19 Source : SimpleFileExtractorTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void AllFiles()
        {
            _extractor.Directories = false;
            _extractor.Pattern = "*";
            _extractor.Check(new ThrowImmediatelyCheckNotifier());

            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));

            _extractor.MoveAll(_outDir,new ThrowImmediatelyDataLoadEventListener(),new GracefulCancellationToken());

            Filereplacedert.Exists(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.Exists(Path.Combine(_outDir.FullName,"blah2.txt"));
        }

19 Source : SimpleFileExtractorTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void PatientFiles()
        {
            _extractor.PerPatient = true;
            _extractor.Directories = false;
            _extractor.Pattern = "$p.txt";
            _extractor.Check(new ThrowImmediatelyCheckNotifier());

            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));

            _extractor.MovePatient("Pat1","Rel1",_outDir,new ThrowImmediatelyDataLoadEventListener(){ThrowOnWarning=true},new GracefulCancellationToken());
            
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));
            Filereplacedert.Exists(Path.Combine(_outDir.FullName,"Rel1.txt"));
        }

19 Source : SimpleFileExtractorTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void OneFile()
        {
            _extractor.Directories = false;
            _extractor.Pattern = "blah.*";
            _extractor.Check(new ThrowImmediatelyCheckNotifier());

            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));

            _extractor.MoveAll(_outDir,new ThrowImmediatelyDataLoadEventListener(),new GracefulCancellationToken());

            Filereplacedert.Exists(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));
            Directoryreplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"Sub1"));
            Directoryreplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"Sub2"));
        }

19 Source : SimpleFileExtractorTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void PatientFileMissingOne()
        {
            _extractor.PerPatient = true;
            _extractor.Directories = false;
            _extractor.Pattern = "$p.txt";
            _extractor.Check(new ThrowImmediatelyCheckNotifier());

            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));

            var mem = new ToMemoryDataLoadEventListener(true);
            
            _extractor.MovePatient("Pat1","Rel1",_outDir,mem,new GracefulCancellationToken());
            _extractor.MovePatient("Pat2","Rel2",_outDir,mem,new GracefulCancellationToken());
            
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah.txt"));
            Filereplacedert.DoesNotExist(Path.Combine(_outDir.FullName,"blah2.txt"));
            Filereplacedert.Exists(Path.Combine(_outDir.FullName,"Rel1.txt"));

            replacedert.AreEqual(ProgressEventType.Warning,mem.GetWorst());
            
            Stringreplacedert.StartsWith("No Files were found matching Pattern Pat2.txt in ",mem.GetAllMessagesByProgressEventType()[ProgressEventType.Warning].Single().Message);
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_LoopCataloguesSuffix()
        {
            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"$foreach Catalogue
## Catalogue '$Name'
$Description
Price: $30
| Column | Description |
$foreach CatalogueItem
| $Name | $Description |
$end
$end

Get in touch with us at [email protected]");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"## Catalogue 'Demog'
This is expensive dataset: $30 to use
Price: $30
| Column | Description |
| Name | Name of the patient |
| Address | Where they live |
| Postcode | Patients postcode |
## Catalogue 'ffff'
A cool dataset with interesting stuff
Price: $30
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info about column 2 |

Get in touch with us at [email protected]", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_LoopCataloguesPrefixAndSuffix()
        {
            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"# Welcome

We love data here, see our datasets:

$foreach Catalogue
## Catalogue '$Name'
$Description
Price: $30
| Column | Description |
$foreach CatalogueItem
| $Name | $Description |
$end
$end

Get in touch with us at [email protected]");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"# Welcome

We love data here, see our datasets:

## Catalogue 'Demog'
This is expensive dataset: $30 to use
Price: $30
| Column | Description |
| Name | Name of the patient |
| Address | Where they live |
| Postcode | Patients postcode |
## Catalogue 'ffff'
A cool dataset with interesting stuff
Price: $30
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info about column 2 |

Get in touch with us at [email protected]", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_LoopCataloguesTableOfContents()
        {
            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"# Welcome
- [Background](#background)
- [Datasets](#datasets)
$foreach Catalogue
   - [$Name](#$Name)
$end

# Background

Boy do we love our datasets here!

# Datasets

$foreach Catalogue
## $Name
$Description
Price: $30
| Column | Description |
$foreach CatalogueItem
| $Name | $Description |
$end
$end

Get in touch with us at [email protected]");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"# Welcome
- [Background](#background)
- [Datasets](#datasets)
   - [Demog](#Demog)
   - [ffff](#ffff)

# Background

Boy do we love our datasets here!

# Datasets

## Demog
This is expensive dataset: $30 to use
Price: $30
| Column | Description |
| Name | Name of the patient |
| Address | Where they live |
| Postcode | Patients postcode |
## ffff
A cool dataset with interesting stuff
Price: $30
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info about column 2 |

Get in touch with us at [email protected]", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void Test_CustomMetadataElementSeperator_JsonExample()
        {
            var templateCode = @"[
$foreach Catalogue
  {
    ""Name"": ""$Name"",
    ""Columns"": [
$foreach CatalogueItem
      {
                ""Name"": ""$Name""
      }$Comma
$end
    ]
  }$Comma
$end
]";

            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName, templateCode);

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"[
  {
    ""Name"": ""Demog"",
    ""Columns"": [
{
                ""Name"": ""Name""
      },
{
                ""Name"": ""Address""
      },
{
                ""Name"": ""Postcode""
      }
    ]
  },
  {
    ""Name"": ""ffff"",
    ""Columns"": [
{
                ""Name"": ""Col1""
      },
{
                ""Name"": ""Col2""
      }
    ]
  }
]", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void Test_CustomMetadataElementSeperator_JsonExample_SemicolonSub()
        {
            var templateCode = @"[
$foreach Catalogue
  {
    ""Name"": ""$Name"",
    ""Columns"": [
$foreach CatalogueItem
      {
                ""Name"": ""$Name""
      }$Comma
$end
    ]
  }$Comma
$end
]";

            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName, templateCode);

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null,";");
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"[
  {
    ""Name"": ""Demog"",
    ""Columns"": [
{
                ""Name"": ""Name""
      };
{
                ""Name"": ""Address""
      };
{
                ""Name"": ""Postcode""
      }
    ]
  };
  {
    ""Name"": ""ffff"",
    ""Columns"": [
{
                ""Name"": ""Col1""
      };
{
                ""Name"": ""Col2""
      }
    ]
  }
]", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_Nullability_WithDQERun()
        {
            var ei1 = WhenIHaveA<ExtractionInformation>();
            var ei2 = WhenIHaveA<ExtractionInformation>();

            ei1.CatalogueItem.Catalogue.Name = "Cata1";
            ei2.CatalogueItem.Catalogue.Name = "Cata2";

            ei1.CatalogueItem.Name = "Cata1Col1";
            ei2.CatalogueItem.Name = "Cata2Col1";

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"# Welcome

We love data here, see our datasets:

$foreach Catalogue
## Catalogue '$Name'
$Description
Price: $30
Number of Records: $DQE_CountTotal
| Column | Description | Nullability | Correct | Missing | Wrong | Invalid | Null (inclusive) | Total |
$foreach CatalogueItem
| $Name | $Description | $DQE_PercentNull | $DQE_CountCorrect | $DQE_CountMissing | $DQE_CountWrong | $DQE_CountInvalidatesRow | $DQE_CountDBNull | $DQE_CountTotal |
$end
Accurate as of : $DQE_DateOfEvaluation
$end");
            var cata1 = ei1.CatalogueItem.Catalogue;
            var cata2 = ei2.CatalogueItem.Catalogue;


            var reporter = new CustomMetadataReport(RepositoryLocator);

            var eval1 = Mock.Of<Evaluation>();

            var eval1_col1 = Mock.Of<ColumnState>();
            eval1_col1.TargetProperty = "Cata1Col1";
            eval1_col1.CountCorrect = 9;
            eval1_col1.CountDBNull = 3; // note that this is seperate from the other counts.  A value can be both null and correct.
            eval1.ColumnStates = new ColumnState[] { eval1_col1 };

            var eval2 = Mock.Of<Evaluation>();
            var eval2_col1 = Mock.Of<ColumnState>();
            eval2_col1.TargetProperty = "Cata2Col1";
            eval2_col1.CountCorrect = 1;
            eval2_col1.CountMissing= 2;
            eval2_col1.CountWrong = 3;
            eval2_col1.CountInvalidatesRow = 4;
            eval2_col1.CountDBNull = 5;
            eval2.ColumnStates = new ColumnState[] { eval2_col1 };

            reporter.EvaluationCache.Add(cata1, eval1);
            reporter.EvaluationCache.Add(cata2, eval2);

            reporter.GenerateReport(new[] {cata1,cata2}, outDir, template, "Datasets.md", true);

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"# Welcome

We love data here, see our datasets:

## Catalogue 'Cata1'

Price: $30
Number of Records: 9
| Column | Description | Nullability | Correct | Missing | Wrong | Invalid | Null (inclusive) | Total |
| Cata1Col1 |  | 33% | 9 | 0 | 0 | 0 | 3 | 9 |
Accurate as of : 01/01/0001 00:00:00
## Catalogue 'Cata2'

Price: $30
Number of Records: 10
| Column | Description | Nullability | Correct | Missing | Wrong | Invalid | Null (inclusive) | Total |
| Cata2Col1 |  | 50% | 1 | 2 | 3 | 4 | 5 | 10 |
Accurate as of : 01/01/0001 00:00:00", resultText.TrimEnd());
        }

19 Source : ExcelConversionTest.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestExcelFunctionality_OnSimpleXlsx()
        {
            var LoadDirectory = CreateLoadDirectoryForTest("TestExcelFunctionality_OnSimpleXlsx");

            //clean SetUp anything in the test project folders forloading directory
            foreach (FileInfo fileInfo in LoadDirectory.ForLoading.GetFiles())
                fileInfo.Delete();

            string targetFile = Path.Combine(LoadDirectory.ForLoading.FullName, "Test.xlsx");

            FileInfo fi = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "DataLoad", "Engine",
                "Resources", "Test.xlsx"));

            Filereplacedert.Exists(fi);

            fi.CopyTo(targetFile, true);

            TestConversionFor(targetFile, "*.xlsx", 5, LoadDirectory);
        }

19 Source : ExcelConversionTest.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestExcelFunctionality_DodgyFileExtension()
        {
            var LoadDirectory = CreateLoadDirectoryForTest("TestExcelFunctionality_DodgyFileExtension");

            //clean SetUp anything in the test project folders forloading directory
            foreach (FileInfo fileInfo in LoadDirectory.ForLoading.GetFiles())
                fileInfo.Delete();

            string targetFile = Path.Combine(LoadDirectory.ForLoading.FullName, "Test.xml");
            FileInfo fi = new FileInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "DataLoad", "Engine",
                "Resources", "XmlTestForExcel.xml"));

            Filereplacedert.Exists(fi);

            fi.CopyTo(targetFile, true);

            var ex = replacedert.Throws<Exception>(()=>TestConversionFor(targetFile, "*.fish", 1, LoadDirectory));

            replacedert.IsTrue(ex.Message.StartsWith("Did not find any files matching Pattern '*.fish' in directory"));
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[TestCase(true)]
        [TestCase(false)]
        public void TestCustomMetadataReport_SingleCatalogue(bool oneFile)
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "ffff";
            cata.Description = null;
            cata.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"| Name | Desc|
| $Name | $Description |");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata }, outDir, template, "$Name.md", oneFile, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"| Name | Desc|
| ffff |  |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_SingleCatalogueWithNoDQEResults()
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "ffff";
            cata.Description = null;
            cata.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"| Name | Desc| Range |
| $Name | $Description | $DQE_StartDate$DQE_EndDate$DQE_DateRange |");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata }, outDir, template, "$Name.md", false, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"| Name | Desc| Range |
| ffff |  | Unknown |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_SingleCatalogue_DQEMetrics()
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "ffff";
            cata.Description = null;
            cata.SaveToDatabase();

            var ei = WhenIHaveA<ExtractionInformation>();
            ei.SelectSQL = "[blah]..[mydate]";
            ei.SaveToDatabase();

            cata.TimeCoverage_ExtractionInformation_ID = ei.ID;
            cata.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"| Name | Desc| StartYear | EndYear | StartMonth | EndMonth | StartDay | EndDay | Range | TimeField |
| $Name | $Description | $DQE_StartYear | $DQE_EndYear | $DQE_StartMonth | $DQE_EndMonth | $DQE_StartDay | $DQE_EndDay | $DQE_StartYear-$DQE_EndYear | $TimeCoverage_ExtractionInformation |");


            var reporter = new CustomMetadataReport(RepositoryLocator)
            {
                NewlineSubsreplacedution = null
            };

            DateTime? ignore;

            var moqDqe = new Mock<IDetermineDatasetTimespan>();
            moqDqe.Setup((f) => f.GetMachineReadableTimespanIfKnownOf(cata, true, out ignore))
                .Returns(new Tuple<DateTime?, DateTime?>(new DateTime(2001, 02, 01), new DateTime(2002, 04, 03)));

            reporter.TimespanCalculator = moqDqe.Object;

            reporter.GenerateReport(new[] { cata }, outDir, template, "$Name.md", false);

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"| Name | Desc| StartYear | EndYear | StartMonth | EndMonth | StartDay | EndDay | Range | TimeField |
| ffff |  | 2001 | 2002 | 02 | 04 | 01 | 03 | 2001-2002 | mydate |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[TestCase(true)]
        [TestCase(false)]
        public void TestCustomMetadataReport_TwoCatalogues(bool oneFile)
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "Forest";
            cata.Administrative_contact_email = "[email protected]";
            cata.SaveToDatabase();

            var cata2 = WhenIHaveA<Catalogue>();
            cata2.Name = "Trees";
            cata2.Description = "trollolol";
            cata2.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.xml"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"<DataSet>
<Name>$Name</Name>
<Desc>$Description</Desc>
<Email>$Administrative_contact_email</Email>
</DataSet>");


            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata, cata2 }, outDir, template,
                oneFile ? "results.xml" : "$Name.xml", oneFile, null);
            cmd.Execute();

            if (oneFile)
            {
                var outFile = Path.Combine(outDir.FullName, "results.xml");

                Filereplacedert.Exists(outFile);
                var resultText = File.ReadAllText(outFile);

                Stringreplacedert.AreEqualIgnoringCase(
                    @"<DataSet>
<Name>Forest</Name>
<Desc></Desc>
<Email>[email protected]</Email>
</DataSet>
<DataSet>
<Name>Trees</Name>
<Desc>trollolol</Desc>
<Email></Email>
</DataSet>", resultText.TrimEnd());
            }
            else
            {
                var outFile1 = Path.Combine(outDir.FullName, "Forest.xml");
                var outFile2 = Path.Combine(outDir.FullName, "Trees.xml");

                Filereplacedert.Exists(outFile1);
                Filereplacedert.Exists(outFile2);

                var resultText1 = File.ReadAllText(outFile1);
                Stringreplacedert.AreEqualIgnoringCase(
                    @"<DataSet>
<Name>Forest</Name>
<Desc></Desc>
<Email>[email protected]</Email>
</DataSet>".Trim(), resultText1.Trim());

                var resultText2 = File.ReadAllText(outFile2);

                Stringreplacedert.AreEqualIgnoringCase(
                    @"<DataSet>
<Name>Trees</Name>
<Desc>trollolol</Desc>
<Email></Email>
</DataSet>".Trim(), resultText2.Trim());

            }

        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestTableInfoProperties_OneTableInfo()
        {
            var ei = WhenIHaveA<ExtractionInformation>();
            var cata = ei.CatalogueItem.Catalogue;
            cata.Name = "ffff";
            cata.Description = "A cool dataset with interesting stuff";
            cata.SaveToDatabase();

            ei.ColumnInfo.TableInfo.Server = "myserver";
            ei.ColumnInfo.TableInfo.SaveToDatabase();


            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"## $Name
Server: $Server
Description: $Description");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata }, outDir, template, "$Name.md", false, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"## ffff
Server: myserver
Description: A cool dataset with interesting stuff", resultText);
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_LoopCataloguesPrefix()
        {
            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"# Welcome

We love data here, see our datasets:

$foreach Catalogue
## Catalogue '$Name'
$Description
Price: $30
| Column | Description |
$foreach CatalogueItem
| $Name | $Description |
$end
$end");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"# Welcome

We love data here, see our datasets:

## Catalogue 'Demog'
This is expensive dataset: $30 to use
Price: $30
| Column | Description |
| Name | Name of the patient |
| Address | Where they live |
| Postcode | Patients postcode |
## Catalogue 'ffff'
A cool dataset with interesting stuff
Price: $30
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info about column 2 |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_ColumnInfoDatatype()
        {
            var ei1 = WhenIHaveA<ExtractionInformation>();
            var ei2 = WhenIHaveA<ExtractionInformation>();

            ei1.CatalogueItem.Catalogue.Name = "Cata1";
            ei2.CatalogueItem.Catalogue.Name = "Cata2";

            ei1.CatalogueItem.ColumnInfo.Data_type = "varchar(10)";
            ei2.CatalogueItem.ColumnInfo.Data_type = "datetime2";

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"# Welcome

We love data here, see our datasets:

$foreach Catalogue
## Catalogue '$Name'
$Description
Price: $30
| Column | Description | Datatype |
$foreach CatalogueItem
| $Name | $Description | $Data_type |
$end
$end");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { ei1.CatalogueItem.Catalogue, ei2.CatalogueItem.Catalogue }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"# Welcome

We love data here, see our datasets:

## Catalogue 'Cata1'

Price: $30
| Column | Description | Datatype |
| MyCataItem |  | varchar(10) |
## Catalogue 'Cata2'

Price: $30
| Column | Description | Datatype |
| MyCataItem |  | datetime2 |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_Nullability_NoDQERun()
        {
            var ei1 = WhenIHaveA<ExtractionInformation>();
            var ei2 = WhenIHaveA<ExtractionInformation>();

            ei1.CatalogueItem.Catalogue.Name = "Cata1";
            ei2.CatalogueItem.Catalogue.Name = "Cata2";

            ei1.CatalogueItem.Name = "Cata1Col1";
            ei2.CatalogueItem.Name = "Cata2Col1";

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"# Welcome

We love data here, see our datasets:

$foreach Catalogue
## Catalogue '$Name'
$Description
Price: $30
Number of Records: $DQE_CountTotal
| Column | Description | Nullability |
$foreach CatalogueItem
| $Name | $Description | $DQE_PercentNull |
$end
$end");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { ei1.CatalogueItem.Catalogue, ei2.CatalogueItem.Catalogue }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"# Welcome

We love data here, see our datasets:

## Catalogue 'Cata1'

Price: $30
Number of Records:
| Column | Description | Nullability |
| Cata1Col1 |  |  |
## Catalogue 'Cata2'

Price: $30
Number of Records:
| Column | Description | Nullability |
| Cata2Col1 |  |  |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[TestCase(true)]
        [TestCase(false)]
        public void TestCustomMetadataReport_CatalogueItems(bool oneFile)
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "ffff";
            cata.Description = "A cool dataset with interesting stuff";
            cata.SaveToDatabase();

            var cataItem1 = new CatalogueItem(RepositoryLocator.CatalogueRepository, cata, "Col1");
            cataItem1.Description = "some info about column 1";
            cataItem1.SaveToDatabase();

            var cataItem2 = new CatalogueItem(RepositoryLocator.CatalogueRepository, cata, "Col2");
            cataItem2.Description = "some info about column 2";
            cataItem2.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"## $Name
$Description
| Column | Description |
$foreach CatalogueItem
| $Name | $Description |
$end");



            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata }, outDir, template, "$Name.md", oneFile, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"## ffff
A cool dataset with interesting stuff
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info about column 2 |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestCustomMetadataReport_TwoCataloguesWithItems()
        {
            Setup2Catalogues(out Catalogue c1, out Catalogue c2);

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"## $Name
$Description
Price: $30
| Column | Description |
$foreach CatalogueItem

| $Name | $Description |
$end");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { c1, c2 }, outDir, template, "Datasets.md", true, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "Datasets.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"## Demog
This is expensive dataset: $30 to use
Price: $30
| Column | Description |
| Name | Name of the patient |
| Address | Where they live |
| Postcode | Patients postcode |
## ffff
A cool dataset with interesting stuff
Price: $30
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info about column 2 |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestNewlineSubsreplacedution_FullTemplate()
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "ffff";
            cata.Description = @"A cool
dataset with interesting stuff";
            cata.SaveToDatabase();

            var cataItem1 = new CatalogueItem(RepositoryLocator.CatalogueRepository, cata, "Col1");
            cataItem1.Description = "some info about column 1";
            cataItem1.SaveToDatabase();

            var cataItem2 = new CatalogueItem(RepositoryLocator.CatalogueRepository, cata, "Col2");
            cataItem2.Description = @"some info 
about column 2";
            cataItem2.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"## $Name
$Description
| Column | Description |
$foreach CatalogueItem
| $Name | $Description |
$end");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata }, outDir, template, "$Name.md", false, "<br/>");
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"## ffff
A cool<br/>dataset with interesting stuff
| Column | Description |
| Col1 | some info about column 1 |
| Col2 | some info <br/>about column 2 |", resultText.TrimEnd());
        }

19 Source : CustomMetadataReportTests.cs
with GNU General Public License v3.0
from HicServices

[Test]
        public void TestTableInfoProperties_NoTableInfo()
        {
            var cata = WhenIHaveA<Catalogue>();
            cata.Name = "ffff";
            cata.Description = "A cool dataset with interesting stuff";
            cata.SaveToDatabase();

            var template = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "template.md"));
            var outDir = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "outDir"));

            if (outDir.Exists)
                outDir.Delete(true);

            outDir.Create();

            File.WriteAllText(template.FullName,
                @"## $Name
Server: $Server
Description: $Description");

            var cmd = new ExecuteCommandExtractMetadata(new ThrowImmediatelyActivator(RepositoryLocator), new[] { cata }, outDir, template, "$Name.md", false, null);
            cmd.Execute();

            var outFile = Path.Combine(outDir.FullName, "ffff.md");

            Filereplacedert.Exists(outFile);
            var resultText = File.ReadAllText(outFile);

            Stringreplacedert.AreEqualIgnoringCase(@"## ffff
Server:
Description: A cool dataset with interesting stuff", resultText);
        }

19 Source : PowerShellTests.cs
with MIT License
from JosefNemec

[Test]
        public void ExecuteWorkDirTest()
        {
            using (var tempDir = TempDirectory.Create())
            {
                Directory.SetCurrentDirectory(tempDir.TempPath);
                using (var runtime = new PowerShellRuntime("ExecuteWorkDirTest"))
                {
                    var outPath = "workDirTest.txt";
                    FileSystem.DeleteFile(outPath);
                    Filereplacedert.DoesNotExist(outPath);
                    runtime.Execute($"'test' | Out-File workDirTest.txt");
                    Filereplacedert.Exists(outPath);

                    FileSystem.CreateDirectory("subdirectory");
                    var tempDir2 = Path.Combine(tempDir.TempPath, "subdirectory");
                    outPath = Path.Combine(tempDir2, outPath);
                    FileSystem.DeleteFile(outPath);
                    Filereplacedert.DoesNotExist(outPath);
                    runtime.Execute($"'test' | Out-File workDirTest.txt", tempDir2);
                    Filereplacedert.Exists(outPath);
                }
                Directory.SetCurrentDirectory("\\");
            }
        }

19 Source : ButlerTests.cs
with MIT License
from JosefNemec

[Test]
        public void InstallationPathsTest()
        {
            Filereplacedert.Exists(Butler.ExecutablePath);
            Filereplacedert.Exists(Butler.DatabasePath);
        }

19 Source : ItchTests.cs
with MIT License
from JosefNemec

[Test]
        public void InstallationPathsTest()
        {            
            Directoryreplacedert.Exists(Itch.InstallationPath);
            Filereplacedert.Exists(Itch.ClientExecPath);
        }

19 Source : UplayLibraryTests.cs
with MIT License
from JosefNemec

[Test]
        public void ConfigurationsParsingTest()
        {
            var cachePath = Uplay.ConfigurationsCachePath;
            Filereplacedert.Exists(cachePath);
            var products = Uplay.GetLocalProductCache();
            Collectionreplacedert.IsNotEmpty(products);
        }