public void ArgumentParsingTest(string appName) { QRGeneratorApplication app = (QRGeneratorApplication)FactoryConsoleApplication.CreateConsoleApplicationObject(appName); OptionSet opt = app.CreateOptionSet(); opt.Parse(args); Hashtable values = app.GetArguments(); foreach (string key in values.Keys) { string value = (string)values[key]; Assert.AreEqual(h[key].ToString(), value, "Arguments parsing incorrect!!!"); } Assert.AreEqual(h.Count, values.Count, "Number of argument parsed is incorrect!!!"); //Test to cover code coverage app.DumpParameter(); }
public void GenerateQrTest(string appName) { byte[] bytes = CreateDummyBitmap(); var mockedConverter = new Mock <IHtmlConverter>(); mockedConverter.Setup(p => p.FromHtmlString(It.IsAny <string>())).Returns(bytes); QRGenerator generator = new QRGenerator(); generator.SetHtmlConverter(mockedConverter.Object); QRGeneratorApplication app = (QRGeneratorApplication)FactoryConsoleApplication.CreateConsoleApplicationObject(appName); app.SetQrGnerator(generator); OptionSet opt = app.CreateOptionSet(); opt.Parse(args); //Update the same key if already exist app.AddArgument("outpath", Path.GetTempPath()); app.Run(); }