static void Main(string[] args) { try { if (!File.Exists(FileName)) { var newRegistry = ProjectGenerator.GenRegistry(3, 10); newRegistry.Save(FileName); } var registry = XmlRegistry.Load(FileName); // Валидация реестра - урлы в проектах и словах XmlRegistry.ValidateRegistry(registry); //------ var apiKey = ConfigurationManager.AppSettings["apikey"]; if (string.IsNullOrEmpty(apiKey)) { throw new InvalidOperationException( "Invalid 'apikey' setting in application config."); } var config = new ClientConfig(apiKey); var client = new ApiClient(config); var syncClient = new SyncClient(client); Console.Write("Project's data loading..."); syncClient.LoadSyncObjects(); Console.WriteLine(); Console.Write("Project's synchronization..."); syncClient.SyncProjects(registry.Projects); Console.WriteLine(); Console.Write("Groups's synchronization..."); syncClient.SyncGroups(registry.Projects); Console.WriteLine(); Console.Write("Keywords's synchronization..."); syncClient.SyncKeywords(registry.Projects); Console.WriteLine(); Console.Write("Synchronization completed, press any key..."); Console.ReadKey(); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("Error:"); Console.WriteLine(ex.ToString()); Console.ResetColor(); Console.Write("Press any key..."); Console.ReadKey(); } }
public void EmptyProjectSiteIsInvalid() { var reg = ProjectGenerator.GenRegistry(1, 0); reg.Projects[0].Site = ""; XmlRegistry.ValidateRegistry(reg); }
public void IncorrectKeywordTargetUrlIsInvalid() { var reg = ProjectGenerator.GenRegistry(1, 0); var group = reg.Projects[0].KeywordGroups.First(); group.Keywords.Clear(); group.Keywords.Add(new XmlKeyword("test", "nourl")); XmlRegistry.ValidateRegistry(reg); }
public void GeneratedRegistryIsValid() { var reg = ProjectGenerator.GenRegistry(3, 10); XmlRegistry.ValidateRegistry(reg); }