Inheritance: IDisposable
示例#1
0
        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);
        }
示例#2
0
        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"));
            }
        }
示例#3
0
        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"));
            }
        }
示例#4
0
 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"}));
     }
 }