public void TestReturnSubclass() { ParameterParser p = new ParameterParser(); p.AddParser(typeof(BarParser)); Bar f = (Bar)p.Parse(typeof(Foo), "woot"); Assert.AreEqual(f.s, "woot"); }
public void ParameterParserTest() { ParameterParser p = new ParameterParser(); p.AddParser(typeof(FooParser)); Foo f = (Foo)p.Parse(typeof(Foo), "woot"); Assert.AreEqual(f.s, "woot"); }
public void TestGoodMerge() { ParameterParser old = new ParameterParser(); old.AddParser(typeof(BarParser)); ParameterParser nw = new ParameterParser(); nw.MergeIn(old); Bar f = (Bar)nw.Parse(typeof(Foo), "woot"); Assert.AreEqual(f.s, "woot"); }
public void TestBadMerge() { string msg = null; try { ParameterParser old = new ParameterParser(); old.AddParser(typeof(BarParser)); ParameterParser nw = new ParameterParser(); nw.AddParser(typeof(FooParser)); nw.MergeIn(old); msg = "Conflict detected when merging parameter parsers! To parse org.apache.reef.tang.implementation.java.TestParameterParser$Foo I have a: TestParameterParser$FooParser the other instance has a: TestParameterParser$BarParser"; } catch (ArgumentException) { } Assert.IsNull(msg); }