public void When_IntArrayProperty_PropertyValuesAreSet() { string[] args = new string[] { nameof(OperationWithArrayProps), $"IntArray=1;2;3" }; IOperation[] operations = Executor.BuildOperations(args, typeof(ExecutorTests).Assembly, Options.Default); Assert.AreEqual(1, operations.Length); Assert.IsInstanceOfType(operations[0], typeof(OperationWithArrayProps)); OperationWithArrayProps operation = (OperationWithArrayProps)operations[0]; Assert.AreEqual(1, operation.IntArray[0]); Assert.AreEqual(2, operation.IntArray[1]); Assert.AreEqual(3, operation.IntArray[2]); }
public void When_StringArrayProperty_PropertyValuesAreSet() { string[] args = new string[] { nameof(OperationWithArrayProps), $"StringArray=aaa;bbb;ccc" }; IOperation[] operations = Executor.BuildOperations(args, typeof(ExecutorTests).Assembly, Options.Default); Assert.AreEqual(1, operations.Length); Assert.IsInstanceOfType(operations[0], typeof(OperationWithArrayProps)); OperationWithArrayProps operation = (OperationWithArrayProps)operations[0]; Assert.AreEqual("aaa", operation.StringArray[0]); Assert.AreEqual("bbb", operation.StringArray[1]); Assert.AreEqual("ccc", operation.StringArray[2]); }
public void When_IntArrayProperty_WithCustomSeparator_PropertyValuesAreSet() { string[] args = new string[] { nameof(OperationWithArrayProps), $"IntArray=1$2$3" }; var options = Options.Default; options.ArrayElementSeparator = '$'; IOperation[] operations = Executor.BuildOperations(args, typeof(ExecutorTests).Assembly, options); Assert.AreEqual(1, operations.Length); Assert.IsInstanceOfType(operations[0], typeof(OperationWithArrayProps)); OperationWithArrayProps operation = (OperationWithArrayProps)operations[0]; Assert.AreEqual(1, operation.IntArray[0]); Assert.AreEqual(2, operation.IntArray[1]); Assert.AreEqual(3, operation.IntArray[2]); }
public void When_ComplextArrayProperty_PropertyValuesAreSet() { string json = @"{ IntValue: 123, StringValue: ""hello world"", BoolValue: true }"; string[] args = new string[] { nameof(OperationWithArrayProps), $"ComplexArray={json};{json};{json}" }; IOperation[] operations = Executor.BuildOperations(args, typeof(ExecutorTests).Assembly, Options.Default); Assert.AreEqual(1, operations.Length); Assert.IsInstanceOfType(operations[0], typeof(OperationWithArrayProps)); OperationWithArrayProps operation = (OperationWithArrayProps)operations[0]; Assert.AreEqual(123, operation.ComplexArray[0].IntValue); Assert.AreEqual("hello world", operation.ComplexArray[1].StringValue); Assert.AreEqual(true, operation.ComplexArray[2].BoolValue); }