internal void AddMappedRepo(RepoMapping mapping) { List <string> mappedRepos = mSection.GetStringList(MAPS_KEY, new string[] { }); mappedRepos.Add(mapping.ToConfigurationString()); mSection.SetStringList(MAPS_KEY, mappedRepos); }
internal void DeleteMappedRepo(RepoMapping mapping) { string mapToRemove = mapping.ToConfigurationString(); List <string> mappedRepos = mSection.GetStringList(MAPS_KEY, new string[] { }); mappedRepos.RemoveAll(item => item.Equals(mapToRemove, StringComparison.InvariantCultureIgnoreCase)); mSection.SetStringList(MAPS_KEY, mappedRepos); }
void AssertRepoMappingEqual(RepoMapping left, RepoMapping right) { Assert.AreEqual( left.SrcRepo, right.SrcRepo, "The SrcRepo property does not match"); Assert.AreEqual( left.DstRepo, right.DstRepo, "The DstRepo property does not match."); Assert.AreEqual( left.DstServer, right.DstServer, "The DstServer property does not match"); }
void DeleteRepoMap(string srcRepo, string dstRepo, string dstServer) { RepoMapping mapping = new RepoMapping(srcRepo, dstRepo, dstServer); Console.WriteLine( "Deleting repository mapping '{0}' -> '{1}@{2}'", mapping.SrcRepo, mapping.DstRepo, mapping.DstServer); ToolConfiguration toolConfig = ToolConfiguration.Load(); toolConfig.RepoMapConfig.DeleteMappedRepo(mapping); toolConfig.Save(); Console.WriteLine("Repository mapping correctly deleted!"); }
public void ParseRepoMappingTest() { string srcRepo = "default"; string dstRepo = "default_dst"; string dstServer = "skull.home:8087"; RepoMapping repoMapping = new RepoMapping(srcRepo, dstRepo, dstServer); List <string> configuration = new List <string>() { repoMapping.ToConfigurationString() }; List <RepoMapping> parsedRepoMappings = RepoMapping.ParseConfiguration(configuration); Assert.AreEqual(1, parsedRepoMappings.Count); AssertRepoMappingEqual(repoMapping, parsedRepoMappings[0]); }
internal List <RepoMapping> GetMappedRepos() { return(RepoMapping.ParseConfiguration( mSection.GetStringList(MAPS_KEY, new string[] { }))); }