1
// ****************************************************************
2
// Copyright 2011, Charlie Poole
3
// This is free software licensed under the NUnit license. You may
4
// obtain a copy of the license at http://nunit.org
5
// ****************************************************************
10
namespace NUnit.ConsoleRunner.Tests
12
public class TestNameParserTests
14
[TestCase("Test.Namespace.Fixture.Method")]
15
[TestCase("Test.Namespace.Fixture.Method,")]
16
[TestCase(" Test.Namespace.Fixture.Method ")]
17
[TestCase(" Test.Namespace.Fixture.Method ,")]
18
[TestCase("Test.Namespace.Fixture.Method()")]
19
[TestCase("Test.Namespace.Fixture.Method(\"string,argument\")")]
20
[TestCase("Test.Namespace.Fixture.Method(1,2,3)")]
21
[TestCase("Test.Namespace.Fixture.Method<int,int>()")]
22
[TestCase("Test.Namespace.Fixture.Method(\")\")")]
23
public void SingleName(string name)
25
string[] names = TestNameParser.Parse(name);
26
Assert.AreEqual(1, names.Length);
27
Assert.AreEqual(name.Trim(new char[] { ' ', ',' }), names[0]);
30
[TestCase("Test.Namespace.Fixture.Method1", "Test.Namespace.Fixture.Method2")]
31
[TestCase("Test.Namespace.Fixture.Method1", "Test.Namespace.Fixture.Method2,")]
32
[TestCase("Test.Namespace.Fixture.Method1(1,2)", "Test.Namespace.Fixture.Method2(3,4)")]
33
[TestCase("Test.Namespace.Fixture.Method1(\"(\")", "Test.Namespace.Fixture.Method2(\"<\")")]
34
public void TwoNames(string name1, string name2)
36
char[] delims = new char[] { ' ', ',' };
37
string[] names = TestNameParser.Parse(name1 + "," + name2);
38
Assert.AreEqual(2, names.Length);
39
Assert.AreEqual(name1.Trim(delims), names[0]);
40
Assert.AreEqual(name2.Trim(delims), names[1]);