public static void AddKeys() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added two keys", () => { var condition = true; string[] keys = null; Act(() => { result = builder.AddKeys(keys, condition); }); And("a condition is true", () => { condition = true; And("keys are provided", () => { keys = new[] { "key1", "key2" }; Should("provide the provided keys", () => { Assert.That(result, Is.EqualTo("-key1 -key2")); }); }); And("keys is null", () => { keys = 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 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 ToString1() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("the builder is empty", () => { Act(() => { builder.ToString(); builder.ToString(); result = builder.ToString(); }); Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); And("a value is added", () => { Act(() => { builder.AddValue("value1"); builder.ToString(); builder.ToString(); result = builder.ToString(); }); Should("provide the added value", () => { Assert.That(result, Is.EqualTo("value1")); }); }); }); }
public static void OperatorString() { ArgsBuilder builder = null; string result = null; When("the builder is null", () => { Act(() => { builder = null; result = builder; }); Should("provide null", () => { Assert.That(result, Is.Null); }); And("the builder is not null and a value is added", () => { Act(() => { builder = ArgsBuilder.By("-", "="); builder.AddValue("value1"); result = builder; }); Should("provide the added value", () => { Assert.That(result, Is.EqualTo("value1")); }); }); }); }
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); }); }); }); }
public static void AddKey() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added a key", () => { var condition = true; string key = null; Act(() => { result = builder.AddKey(key, condition); }); And("a condition is true", () => { condition = true; And("the key is provided", () => { key = "key1"; Should("provide the provided key", () => { Assert.That(result, Is.EqualTo("-key1")); }); }); 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); }); }); }); }
public static void AddArguments() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added arguments", () => { var condition = true; string key = null; string[] values = null; var multipleTimes = false; Act(() => { result = builder.AddArguments(key, values, multipleTimes, condition); }); And("a condition is true", () => { condition = true; And("the key is provided", () => { key = "key1"; And("the values has null value", () => { values = new[] { "value1", null }; Should("provide only non-null values", () => { Assert.That(result, Is.EqualTo("-key1=value1")); }); }); And("the values are provided", () => { values = new[] { "value1", "value2" }; Should("provide the argument with the provided key and values", () => { Assert.That(result, Is.EqualTo("-key1=value1;value2")); }); And("the key with values should be added multiple times", () => { multipleTimes = true; Should("provide the argument with the provided values with teir own keys", () => { Assert.That(result, Is.EqualTo("-key1=value1 -key1=value2")); }); }); }); And("the values is null", () => { values = 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); }); }); }); }
public static void AddValues() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added two values", () => { var condition = true; string[] values = null; Act(() => { result = builder.AddValues(values, condition); }); And("a condition is true", () => { condition = true; And("the values has null value", () => { values = new[] { "value1", null }; Should("provide only non-null values", () => { Assert.That(result, Is.EqualTo("value1")); }); }); And("values are provided", () => { values = new[] { "value1", "value2" }; Should("provide arguments with the provided values", () => { Assert.That(result, Is.EqualTo("value1 value2")); }); }); And("values is null", () => { values = 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 AddValue() { ArgsBuilder builder = null; string result = null; Arrange(() => { builder = ArgsBuilder.By("-", "="); }); When("added a value", () => { var condition = true; string value = null; Act(() => { result = builder.AddValue(value, condition); }); And("a condition is true", () => { condition = true; And("the value is provided", () => { value = "value1"; Should("provide the provided value", () => { Assert.That(result, Is.EqualTo(value)); }); }); And("the value is an empty string", () => { value = string.Empty; Should("provide an empty string", () => { Assert.That(result, Is.Empty); }); }); And("the value is null", () => { value = 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); }); }); }); }