public void AtsignFilenameTests(string commandLine, string testFileNames, string testFileContents, string expectedArgs, string expectedErrors) { var ee = expectedErrors.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); var tfn = testFileNames.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var tfc = testFileContents.Split(new[] { '|' }); var tfs = new TestFile[tfn.Length]; for (int ix = 0; ix < tfn.Length; ++ix) tfs[ix] = new TestFile(Path.Combine(TestContext.CurrentContext.TestDirectory, tfn[ix]), tfc[ix], true); var options = new NUnitLiteOptions(); string actualExpectedArgs; try { actualExpectedArgs = String.Join(" ", options.PreParse(CommandLineOptions.GetArgs(commandLine)).ToArray()); } finally { foreach (var tf in tfs) tf.Dispose(); } Assert.AreEqual(expectedArgs, actualExpectedArgs); Assert.AreEqual(options.ErrorMessages, ee); }
public void ThreeTestsFromATestListFile() { using (var tf = new TestFile("TestListFile.txt", "TestListFile.txt")) { var filter = GetFilter("--testlist:" + tf.File.FullName); Assert.That(filter, Is.TypeOf<OrFilter>()); var filters = ((OrFilter)filter).Filters; Assert.That(filters.Count, Is.EqualTo(3)); Assert.That(filters[0], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[0]).ExpectedValue, Is.EqualTo("My.First.Test")); Assert.That(filters[1], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[1]).ExpectedValue, Is.EqualTo("My.Second.Test")); Assert.That(filters[2], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[2]).ExpectedValue, Is.EqualTo("My.Third.Test")); } }
public void SixTestsFromTwoTestListFiles() { using (var tf = new TestFile("TestListFile.txt", "TestListFile.txt")) using (var tf2 = new TestFile("TestListFile2.txt", "TestListFile2.txt")) { var filter = GetFilter("--testlist:" + tf.File.FullName, "--testlist:" + tf2.File.FullName ); Assert.That(filter, Is.TypeOf<OrFilter>()); var filters = ((OrFilter)filter).Filters; Assert.That(filters.Count, Is.EqualTo(6)); Assert.That(filters[0], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[0]).ExpectedValue, Is.EqualTo("My.First.Test")); Assert.That(filters[1], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[1]).ExpectedValue, Is.EqualTo("My.Second.Test")); Assert.That(filters[2], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[2]).ExpectedValue, Is.EqualTo("My.Third.Test")); Assert.That(filters[3], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[3]).ExpectedValue, Is.EqualTo("My.Fourth.Test")); Assert.That(filters[4], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[4]).ExpectedValue, Is.EqualTo("My.Fifth.Test")); Assert.That(filters[5], Is.TypeOf<FullNameFilter>()); Assert.That(((FullNameFilter)filters[5]).ExpectedValue, Is.EqualTo("My.Sixth.Test")); } }
public void SixTestsFromTwoTestListFiles() { using (var tf = new TestFile("TestListFile.txt", "TestListFile.txt")) using (var tf2 = new TestFile("TestListFile2.txt", "TestListFile2.txt")) { var filter = GetFilter("--testlist:" + tf.File.FullName, "--testlist:" + tf2.File.FullName ); Assert.That(filter, Is.TypeOf<SimpleNameFilter>()); Assert.That(((SimpleNameFilter)filter).Values, Is.EqualTo(new string[] { "My.First.Test", "My.Second.Test", "My.Third.Test", "My.Fourth.Test", "My.Fifth.Test", "My.Sixth.Test"})); } }