public void Help_Defined() { var mock = new Mock<IPrinter>(); var sample = new Sample_10 { Printer = mock.Object }; var p = new Parser<Sample_10>(); p.Run("-showhelp".Split(' '), sample); p.Run("showhelp".Split(' '), sample); mock.Verify(o => o.Print("help"), Times.Exactly(2)); }
public void Global_Defined_WithValidation() { var mock = new Mock<IPrinter>(); var sample = new Sample_10 { Printer = mock.Object }; var p = new Parser<Sample_10>(); p.Run("print -mish:5".Split(' '), sample); mock.Verify(o => o.Print("mesh"), Times.Exactly(5)); }
public void Global_Defined_WithArg() { var mock = new Mock<IPrinter>(); var sample = new Sample_10 { Printer = mock.Object }; var p = new Parser<Sample_10>(); p.Run("print -foo:blah".Split(' '), sample); mock.Verify(o => o.Print("blah")); }
public void Global_Defined_NoArgs() { var mock = new Mock<IPrinter>(); var sample = new Sample_10 { Printer = mock.Object }; var p = new Parser<Sample_10>(); p.Run("print -bar".Split(' '), sample); mock.Verify(o => o.Print("zoo")); }
public void Global_Defined_BadConvertion() { var mock = new Mock<IPrinter>(); var sample = new Sample_10 { Printer = mock.Object }; var p = new Parser<Sample_10>(); Expect(() => p.Run("print -abra1:cadabra".Split(' '), sample), Throws.InstanceOf<TypeConvertionException>()); }
public void Global_Defined_BadConvertion() { var mock = new Mock<IPrinter>(); var sample = new Sample_10 { Printer = mock.Object }; var p = new Parser<Sample_10>(); p.Run("print -abra:cadabra".Split(' '), sample); }