public void TestCopy() { var parseSuccess = argumentParser.Parse(new[] { "--apikey", "secret", "--action", "copy", "--source", "/source/file", "--target", "/target/file" }); parseSuccess.Should().BeTrue(); dummyClient.ApiKey.Should().Be("secret"); dummyClient.CopyFileCalls.Should().BeEquivalentWithSameOrdering(("/source/file", "/target/file")); }
public void _Read(string settings) { if (string.IsNullOrEmpty(settings)) { return; } InjectMap outsideSettings = parser.Parse <InjectMap>(settings); foreach (BindMap bindMapCurr in injectMap.bind) { // If there hasn't setting, leave loop. if (outsideSettings.bind == null) { break; } BindMap bindMapNew = null; bindMapNew = Array.Find( outsideSettings.bind, (BindMap bm) => bm.bind.Equals(bindMapCurr.bind) ); if (bindMapNew != null) { bindMapCurr.to = String.Copy(bindMapNew.to); } } foreach (PrimitiveMap primitiveMapCurr in injectMap.primitive) { // If there hasn't setting, leave loop. if (outsideSettings.primitive == null) { break; } PrimitiveMap primitiveMapNew = null; primitiveMapNew = Array.Find( outsideSettings.primitive, (PrimitiveMap pm) => pm.fieldPath.Equals(primitiveMapCurr.fieldPath) ); if (primitiveMapNew != null) { primitiveMapCurr.fieldValue = String.Copy(primitiveMapNew.fieldValue); } } foreach (PrimitiveArrayMap primitiveArrayMapCurr in injectMap.primitiveArray) { // If there hasn't setting, leave loop. if (outsideSettings.primitiveArray == null) { break; } PrimitiveArrayMap PrimitiveArrayMapNew = null; PrimitiveArrayMapNew = Array.Find( outsideSettings.primitiveArray, (PrimitiveArrayMap pam) => pam.fieldPath.Equals(primitiveArrayMapCurr.fieldPath) ); if (PrimitiveArrayMapNew != null) { Array.Copy(PrimitiveArrayMapNew.fieldValue, primitiveArrayMapCurr.fieldValue, PrimitiveArrayMapNew.fieldValue.Length); } } //Due to new settings changed, reinject level of logger Inject(logger); }