public void DomainCreateTest() { string ApiKey = "1_885bd9d868494d078d4394809f5ca7ac"; string apiHostdomain = "localhost"; int port = 9715; bool ssl = false; Client target = new Client(ApiKey, apiHostdomain, port, ssl); string name = "demo1.com"; string planAlias = "GOLD_PLAN"; string username = "******"; string password = "******"; bool activedomainuser = false; string firstName = "Demo"; string lastName = "Customer"; string email = "*****@*****.**"; ApiResult actual = target.DomainCreate(name, planAlias, username, password, activedomainuser, firstName, lastName, email); Assert.AreEqual(0, actual.Code); }
public void ImportDomains() { var _sb = new StringBuilder(); _sb.AppendFormat("API Key: {0}", Settings.Default.apiKey).AppendLine(); _sb.AppendFormat("Reseller Name: {0}",Settings.Default.resellerName).AppendLine(); _sb.AppendFormat("Start Time: {0}", DateTime.Now).AppendLine().AppendLine(); var client = new Client(Settings.Default.apiKey, Settings.Default.host, Settings.Default.port, false); var domains = String.IsNullOrEmpty(Settings.Default.resellerName) ? _db.GetDomains() : _db.GetDomains().Where(m => m.ClientName == Settings.Default.resellerName); var domainFilter = GetDomainFilter(); if (domainFilter.Any()) domains = domains.Where(m => domainFilter.Contains(m.Name)).ToList(); foreach (var item in domains) { var result = Settings.Default.importDomains ? client.DomainCreate(item.Name, Settings.Default.domainPlanName, item.Username, item.Password, !String.IsNullOrEmpty(item.DomainPassword), expiration: item.Expiration) : new ApiResult() { Code = 0, Message = "Domain Import is Disabled" }; if (result.Code == 0) { if(Settings.Default.importDomains) PrintAndLog(String.Format("Domain Added: {0}", item.Name), ref _sb); ImportEmails(item.Name, ref _sb); if (Settings.Default.importDatabases) ImportDatabases(item.Name, ref _sb); if (Settings.Default.importSubdomains) ImportSubdomain(item.Name, ref _sb); if (Settings.Default.importDomainAlias) ImportDomainAlias(item.Name, ref _sb); if (Settings.Default.CopyFiles) CopyHttpFiles(item.Name, ref _sb); } else { PrintAndLog(String.Format("Domain Error: {0} - {1}", item.Name, result.Message), ref _sb); } } _sb.AppendLine().AppendFormat("End Time Time: {0}", DateTime.Now); WriteLog(_sb.ToString()); }