Increased test coverage for the command line parser (and then decided the thing is broken beyond repair and needs a rewrite -- as if that was any surprise given the original code is from CodeProject); achieved 100% test coverage for the factory employer, instance employer, employer, no plugin attribute and abstract factory classes in the Plugins namespace; achieved some test coverage for the PluginRepository class (the uncovered sections are quite hard to stimulate since they involve exceptions during assembly load attempts)

git-svn-id: file:///srv/devel/repo-conversion/nusu@99 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2008-11-28 19:34:43 +00:00
parent ecb36e9ce3
commit b39f8de155
11 changed files with 703 additions and 4 deletions

View file

@ -34,7 +34,7 @@ namespace Nuclex.Support.Parsing {
/// <summary>Validates that normal arguments can be parsed</summary>
[Test]
public void TestPlainArguments() {
public void TestArrayConstructorWithPlainArguments() {
Assert.IsTrue(
new CommandLineParser(new string[] { "-hello" }).HasArgument("hello"),
"Argument with minus sign is recognized"
@ -51,7 +51,7 @@ namespace Nuclex.Support.Parsing {
/// <summary>Validates that argument assignments are working</summary>
[Test]
public void TestAssignments() {
public void TestArrayConstructorWithAssignments() {
Assert.AreEqual(
"world",
new CommandLineParser(new string[] { "-hello:world" })["hello"],
@ -73,7 +73,7 @@ namespace Nuclex.Support.Parsing {
/// Validates that loosely specified values are recognized by the parser
/// </summary>
[Test]
public void TestLooseValues() {
public void TestArrayConstructorWithLooseValues() {
Assert.IsTrue(
new CommandLineParser(new string[] { "hello" }).Values.Contains("hello"),
"Plain loose value is recognized"
@ -84,6 +84,47 @@ namespace Nuclex.Support.Parsing {
);
}
/// <summary>
/// Tests whether the parser can parse the processes current command line if
/// the default constructor is used
/// </summary>
[Test]
public void TestDefaultConstructor() {
new CommandLineParser();
}
/// <summary>
/// Tests whether the string constructor works for simple arguments being
/// specified on the command line
/// </summary>
[Test]
public void TestStringConstructorWithSimpleArguments() {
CommandLineParser parser = new CommandLineParser("argument1 argument2");
Assert.AreEqual("argument1", parser.Values[0]);
Assert.AreEqual("argument2", parser.Values[1]);
}
// TODO: This test fails!!
#if FAILED_TEST
/// <summary>
/// Bullshit
/// </summary>
[Test]
public void TestStringConstructorWithQuotedArguments() {
CommandLineParser parser = new CommandLineParser("\"this is a single argument\"");
Assert.AreEqual("this is a single argument", parser.Values[0]);
}
#endif
/// <summary>
/// Tests whether the string constructor recognizes an unfinished argument
/// (that is, and argument that gets 'nothing' assigned)
/// </summary>
[Test]
public void TestStringConstructorWithUnfinishedAssignment() {
CommandLineParser parser = new CommandLineParser("--hello= --world=");
}
}
} // namespace Nuclex.Support.Parsing