public void Parse(IEnumerable <string> args, int id) { var src = new ArgumentCollection(args, '/', true); Assert.That(src.GetTimeout(), Is.EqualTo(300)); Assert.That(src.GetRetryCount(), Is.EqualTo(10)); Assert.That(src.GetCommand(), Is.Not.Null.And.Not.Empty); Assert.That(src.GetConfiguration(), Is.Not.EqualTo("Sample.json").And.EndWith("Sample.json")); Assert.That(src.GetResourceDirectory(), Is.Not.EqualTo("Printers").And.EndWith("Printers")); }
/* ----------------------------------------------------------------- */ /// /// CreateInstaller /// /// <summary> /// Creates a new instance of the Installer class with the /// specified arguments. /// </summary> /// /// <param name="src">Source arguments.</param> /// /// <returns>Installer object.</returns> /// /* ----------------------------------------------------------------- */ public static Installer CreateInstaller(this ArgumentCollection src) { var dest = new Installer(Format.Json, src.GetConfiguration()) { Recursive = src.HasForceOption(), ResourceDirectory = src.GetResourceDirectory(), }; src.ReplaceDirectory(dest.Config); return(dest); }
public void Parse_Empty() { var src = new ArgumentCollection(new string[0], '/', true); var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Assert.That(src.GetTimeout(), Is.EqualTo(30)); Assert.That(src.GetRetryCount(), Is.EqualTo(1)); Assert.That(src.GetCommand(), Is.Empty); Assert.That(src.GetConfiguration(), Is.Null); Assert.That(src.GetResourceDirectory(), Is.EqualTo(dir)); }