public void AddIfWithValueAddsOnTrue() { var args = new PrivateArguments(); args.AddIf(true, "testValue"); Assert.AreEqual(1, args.Count); Assert.AreEqual("testValue", args.ToString()); }
public void AddIfWithValueDoesNotAddOnFalse() { var args = new PrivateArguments(); args.AddIf(false, "testValue"); Assert.AreEqual(0, args.Count); Assert.AreEqual(string.Empty, args.ToString()); }
public void AddIfWithAutoQuoteValueAddsOnTrue() { var args = new PrivateArguments(); args.AddIf(true, "pre=", "test Value", true); Assert.AreEqual(1, args.Count); Assert.AreEqual("pre=\"test Value\"", args.ToString()); }
private PrivateArguments LabelProcessInfoArgs(string label, string oldLabel) { var builder = new PrivateArguments(); builder.Add("label ", Project, true); builder.Add("-L", label); builder.AddIf(!string.IsNullOrEmpty(oldLabel), "-VL", oldLabel); AppendUsernameAndPassword(builder); builder.Add("-I-Y"); return builder; }
private PrivateArguments GetSourceArgs(IIntegrationResult result) { var builder = new PrivateArguments(); builder.Add("get ", Project + "/*?*", true); builder.Add(RecursiveCommandLineOption); builder.AddIf(ApplyLabel, "-VL", tempLabel); builder.AddIf(!AlwaysGetLatest, "-Vd", locale.FormatCommandDate(result.StartTime)); AppendUsernameAndPassword(builder); builder.Add("-I-N -W -GF- -GTM"); builder.AddIf(CleanCopy, "-GWR"); return builder; }
private ProcessInfo PropGetProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments("propget"); buffer.AddIf(CheckExternalsRecursive, "-R"); AppendCommonSwitches(buffer); buffer.Add("svn:externals"); buffer.Add(TrunkUrl); return NewProcessInfo(buffer, result); }
private void AppendCommonSwitches(PrivateArguments buffer, bool isExternal) { if ((this.AuthCaching != AuthCachingMode.Always) && (!isExternal || (this.AuthCaching == AuthCachingMode.None))) { buffer.AddIf(!string.IsNullOrEmpty(this.Username), "--username ", this.Username, true); buffer.AddIf(this.Password != null, "--password ", this.Password, true); buffer.Add("--no-auth-cache"); } buffer.Add("--non-interactive"); }
private static void AppendRevision(PrivateArguments buffer, int revision) { buffer.AddIf(revision > 0, "--revision ", revision.ToString()); }
/// <summary> /// Creates the get process. /// </summary> /// <param name="filename">The filename.</param> /// <returns></returns> /// <remarks></remarks> public ProcessInfo CreateGetProcess(string filename) { // @"getlatest ""{0}"" -s ""{1}"" -d ""{2}"" -u ""{3}"" -p ""{4}"" -localpath ""{5}"" -overwritewritable replace -overwritecheckedout replace -response:GetLatest.PathInvalid y -response:GetLatest.Writable y -response:GetLatest.CheckedOut y" var args = new PrivateArguments(); args.Add("getlatest ", filename, true); args.Add("-s ", Server, true); args.Add("-d ", Database, true); args.Add("-u ", Username, true); args.Add("-p ", Password, true); args.AddIf(!string.IsNullOrEmpty(WorkingDirectory), "-localpath ", WorkingDirectory, true); args.Add("-overwritewritable replace -overwritecheckedout replace -response:GetLatest.PathInvalid y -response:GetLatest.Writable y -response:GetLatest.CheckedOut y"); return new ProcessInfo(Executable, args); }
/// <summary> /// Adds the common optional arguments. /// </summary> /// <param name="builder">The builder.</param> /// <remarks></remarks> protected void AddCommonOptionalArguments(PrivateArguments builder) { builder.AddIf(!string.IsNullOrEmpty(_shim.Host), "-host ", _shim.Host); builder.AddIf(!string.IsNullOrEmpty(_shim.Username), "-user ", _shim.Username); builder.AddIf(_shim.Password != null, "-password ", _shim.Password); builder.AddIf(!string.IsNullOrEmpty(_shim.Repository), "-repository ", _shim.Repository, true); builder.AddIf(_shim.Ssl, "-ssl"); builder.AddIf(!string.IsNullOrEmpty(_shim.proxyServer), "-proxyserver ", _shim.proxyServer); builder.AddIf(!string.IsNullOrEmpty(_shim.proxyPort), "-proxyport ", _shim.proxyPort); builder.AddIf(!string.IsNullOrEmpty(_shim.proxyUser), "-proxyuser ", _shim.proxyUser); builder.AddIf(!string.IsNullOrEmpty(_shim.proxyPassword), "-proxypassword ", _shim.proxyPassword); builder.AddIf(!string.IsNullOrEmpty(_shim.proxyDomain), "-proxydomain ", _shim.proxyDomain); builder.Add(_shim.otherVaultArguments); }
private static void AppendRevision(PrivateArguments buffer, int revision) { buffer.AddIf(revision > 0, "--revision ", revision.ToString(CultureInfo.CurrentCulture)); }