diff --git a/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.csv b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.csv new file mode 100644 index 000000000..44ed3de1d --- /dev/null +++ b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.csv @@ -0,0 +1,3 @@ +fileSut;fileAssert +..\csv\001.csv;..\txt\001.txt +..\csv\002.csv;..\txt\002.txt \ No newline at end of file diff --git a/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.expected.nbits b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.expected.nbits new file mode 100644 index 000000000..6b676d0d8 --- /dev/null +++ b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.expected.nbits @@ -0,0 +1,42 @@ + + + + + + + + ..\csv\001.csv + + + + + + + + ..\txt\001.txt + + + + + + + + + + + ..\csv\002.csv + + + + + + + + ..\txt\002.txt + + + + + + + \ No newline at end of file diff --git a/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.genbil b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.genbil new file mode 100644 index 000000000..34a8eaf86 --- /dev/null +++ b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.genbil @@ -0,0 +1,6 @@ +case load file 'Acceptance\GenbiL\Resources\ResultSetFile.csv'; + +template load file 'Acceptance\GenbiL\Resources\ResultSetFile.nbitt'; +suite generate; +suite save as 'Acceptance\GenbiL\Resources\ResultSetFile.nbits'; + diff --git a/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.nbitt b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.nbitt new file mode 100644 index 000000000..48855c001 --- /dev/null +++ b/NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.nbitt @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/NBi.Testing/Acceptance/GenbiL/ResultSetFileTest.cs b/NBi.Testing/Acceptance/GenbiL/ResultSetFileTest.cs new file mode 100644 index 000000000..f06ba43ac --- /dev/null +++ b/NBi.Testing/Acceptance/GenbiL/ResultSetFileTest.cs @@ -0,0 +1,73 @@ +using System; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using NBi.GenbiL; +using NUnit.Framework; + +namespace NBi.Testing.Acceptance.GenbiL +{ + [TestFixture] + public class ResultSetFileTest + { + private const string TEST_SUITE_NAME="ResultSetFile"; + private string DefinitionFilename { get => $"Acceptance\\GenbiL\\Resources\\{TEST_SUITE_NAME}.genbil"; } + private string TargetFilename { get => $"Acceptance\\GenbiL\\Resources\\{TEST_SUITE_NAME}.nbits"; } + private string ExpectedFilename { get => $"Acceptance\\GenbiL\\Resources\\{TEST_SUITE_NAME}.expected.nbits"; } + + #region SetUp & TearDown + //Called only at instance creation + [TestFixtureSetUp] + public void SetupMethods() + { + + } + + //Called only at instance destruction + [TestFixtureTearDown] + public void TearDownMethods() + { + + } + + //Called before each test + [SetUp] + public void SetupTest() + { + if (File.Exists(TargetFilename)) + File.Delete(TargetFilename); + } + + //Called after each test + [TearDown] + public void TearDownTest() + { + //if (File.Exists(TargetFilename)) + // File.Delete(TargetFilename); + } + #endregion + + [Test] + public void Execute_Group_FileGenerated() + { + var generator = new TestSuiteGenerator(); + generator.Load(DefinitionFilename); + generator.Execute(); + + Assert.That(File.Exists(TargetFilename)); + } + + [Test] + public void Execute_Group_ExpectedContent() + { + var generator = new TestSuiteGenerator(); + generator.Load(DefinitionFilename); + generator.Execute(); + + var expected = File.ReadAllText(ExpectedFilename); + var actual = File.ReadAllText(TargetFilename); + actual = Regex.Replace(actual, @"(\s*)", "", RegexOptions.Multiline); + Assert.That(actual, Is.EqualTo(expected)); + } + } +} diff --git a/NBi.Testing/NBi.Testing.csproj b/NBi.Testing/NBi.Testing.csproj index 119787114..3af7638d8 100644 --- a/NBi.Testing/NBi.Testing.csproj +++ b/NBi.Testing/NBi.Testing.csproj @@ -117,6 +117,7 @@ + @@ -352,7 +353,19 @@ Always - + + Always + + + Always + + + Always + + + Always + + Always @@ -361,10 +374,10 @@ Always - + Always - + Always @@ -751,7 +764,7 @@ Always - + Always