public static void AddPaths1() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added paths", () => { var condition = true; var paths = new[] { "path1", "path2" }; Act(() => { result = builder.AddPaths(paths, condition); }); And("a condition is true", () => { condition = true; Should("provide the paths", () => { Assert.That(result, Is.EqualTo("\"path1\" \"path2\"")); }); And("the paths is null", () => { paths = null; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); }); And("a condition is false", () => { condition = false; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); }); }
public static void By() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "=", ";", "\"", " "); }); When("added two paths and a key with a value", () => { var condition = true; Act(() => { result = builder .AddPaths("key1", new[] { "path1", "path2" }, false, condition) .AddArgument("key2", "value2", condition) .ToString(); }); And("a condition is true", () => { condition = true; Should("provide arguments with provided paths and the key with the value", () => { Assert.That(result, Is.EqualTo("-key1=\"path1\";\"path2\" -key2=value2")); }); }); And("a condition is false", () => { condition = false; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); }); }
public static void AddPaths2() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added paths", () => { var condition = true; string key = null; string[] paths = null; var multipleTimes = false; Act(() => { result = builder.AddPaths(key, paths, multipleTimes, condition); }); And("a condition is true", () => { condition = true; And("the key is provided", () => { key = "key1"; And("the paths are provided", () => { paths = new[] { "path1", "path2" }; Should("provide the key with the provided paths", () => { Assert.That(result, Is.EqualTo("-key1=\"path1\";\"path2\"")); }); }); And("the key with paths should be added multiple times", () => { multipleTimes = true; Should("provide the key with the provided paths with teir own keys", () => { Assert.That(result, Is.EqualTo("-key1=\"path1\" -key1=\"path2\"")); }); }); And("the paths is null", () => { paths = null; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); And("the key is an empty string", () => { key = string.Empty; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); And("the key is null", () => { key = null; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); }); }); And("a condition is false", () => { condition = false; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); }); }