void TestMe(TestMeGen <DateTime> g, string[] args, bool mustThrow) { try { var z = g.TPTest <string, string>(args, "d", 10); foreach (var i in z.Result) { Console.WriteLine("Result = {0}", i); } if (mustThrow) { throw new Exception("failed to throw"); } } catch (AggregateException ae) { if (ae.Flatten().InnerException is ArgumentException) { if (!mustThrow) { throw; } } else { throw; } } }
void Test() { var g = new TestMeGen <DateTime>(); TestMe(g, new[] { "a" }, false); TestMe(g, new[] { "a", "b" }, false); TestMe(g, new[] { "a", "b" }, false); if (!behave) { TestMe(g, new[] { "a", "b", "c", "e", "f", "g" }, true); } }