private void DeleteNugetConfig() { ScalarProcess scalar = new ScalarProcess(ScalarTestConfig.PathToScalar, enlistmentRoot: null, localCacheRoot: null); scalar.DeleteConfig(NugetFeedURLKey); scalar.DeleteConfig(NugetFeedPackageNameKey); }
private void ReadNugetConfig(out string feedUrl, out string feedName) { ScalarProcess scalar = new ScalarProcess(ScalarTestConfig.PathToScalar, enlistmentRoot: null, localCacheRoot: null); // failOnError is set to false because scalar config read can exit with // GenericError when the key-value is not available in config file. That // is normal. feedUrl = scalar.ReadConfig(NugetFeedURLKey, failOnError: false); feedName = scalar.ReadConfig(NugetFeedPackageNameKey, failOnError: false); }
private void WriteNugetConfig(string feedUrl, string feedName) { ScalarProcess scalar = new ScalarProcess(ScalarTestConfig.PathToScalar, enlistmentRoot: null, localCacheRoot: null); if (!string.IsNullOrEmpty(feedUrl)) { scalar.WriteConfig(NugetFeedURLKey, feedUrl); } if (!string.IsNullOrEmpty(feedName)) { scalar.WriteConfig(NugetFeedPackageNameKey, feedName); } }
private void RunServiceCommandAndCheckOutput(string argument, string[] expectedRepoRoots, string[] unexpectedRepoRoots = null) { ScalarProcess scalarProcess = new ScalarProcess( ScalarTestConfig.PathToScalar, enlistmentRoot: null, localCacheRoot: null); string result = scalarProcess.RunServiceVerb(argument); result.ShouldContain(expectedRepoRoots); if (unexpectedRepoRoots != null) { result.ShouldNotContain(false, unexpectedRepoRoots); } }
private void RunListCommand(string workdir, string[] expectedRepoRoots, string[] unexpectedRepoRoots = null) { ScalarProcess scalarProcess = new ScalarProcess( ScalarTestConfig.PathToScalar, enlistmentRoot: workdir, localCacheRoot: null); string result = scalarProcess.ListRepos(); result.ShouldContain(expectedRepoRoots); if (unexpectedRepoRoots != null) { result.ShouldNotContain(ignoreCase: false, unexpectedRepoRoots); } }
public void UnregisterRemovesFromList() { ScalarFunctionalTestEnlistment enlistment1 = this.CreateNewEnlistment(); ScalarFunctionalTestEnlistment enlistment2 = this.CreateNewEnlistment(); string[] repoRootList = new string[] { enlistment1.EnlistmentRoot, enlistment2.EnlistmentRoot }; string workDir = Directory.GetCurrentDirectory(); this.RunListCommand(workDir, expectedRepoRoots: repoRootList); ScalarProcess process = new ScalarProcess(ScalarTestConfig.PathToScalar, "", ""); process.Unregister(enlistment1.EnlistmentRoot); this.RunListCommand( workDir, expectedRepoRoots: new[] { enlistment2.EnlistmentRoot }, unexpectedRepoRoots: new[] { enlistment1.EnlistmentRoot }); }
public void ServiceListRegistered() { ScalarFunctionalTestEnlistment enlistment1 = this.CreateNewEnlistment(); ScalarFunctionalTestEnlistment enlistment2 = this.CreateNewEnlistment(); string[] repoRootList = new string[] { enlistment1.EnlistmentRoot, enlistment2.EnlistmentRoot }; ScalarProcess scalarProcess1 = new ScalarProcess( ScalarTestConfig.PathToScalar, enlistment1.EnlistmentRoot, enlistment1.LocalCacheRoot); ScalarProcess scalarProcess2 = new ScalarProcess( ScalarTestConfig.PathToScalar, enlistment2.EnlistmentRoot, enlistment2.LocalCacheRoot); // Do not check for unexpected repos, as other repos on the machine may be registered while // this test is running this.RunServiceCommandAndCheckOutput("--list-registered", expectedRepoRoots: repoRootList); }