public bool IsValid() { var clientId = HelperMethods.GetAppSettingsValue("ClientId", true); var clientSecret = HelperMethods.GetAppSettingsValue("ClientSecret", true); return(!string.IsNullOrWhiteSpace(clientId) && !string.IsNullOrWhiteSpace(clientSecret)); }
public bool IsValid() { var userName = HelperMethods.GetAppSettingsValue("Username", true); var password = HelperMethods.GetAppSettingsValue("Password", true); return(!string.IsNullOrWhiteSpace(userName) && !string.IsNullOrWhiteSpace(password)); }
private Dictionary <string, DefaultDataField[]> ReadDefaultData() { string defaultDataFile = HelperMethods.GetAppSettingsValue("DefaultDataFile", true); if (string.IsNullOrEmpty(defaultDataFile)) { return(new Dictionary <string, DefaultDataField[]>()); } XmlSerializer ser = new XmlSerializer(typeof(DefaultData)); FileInfo dllPath = new FileInfo(Assembly.GetExecutingAssembly().Location); FileInfo file = new FileInfo(string.Format(@"{0}\{1}", dllPath.DirectoryName, defaultDataFile)); using (XmlReader reader = XmlReader.Create(file.FullName)) { DefaultData data = ser.Deserialize(reader) as DefaultData; if (data == null || data.Entities == null || data.Entities.Length == 0) { Logger.WriteLine("DefaultData is empty"); return(new Dictionary <string, DefaultDataField[]>()); } return(data.Entities.ToDictionary(e => e.Name, e => e.Fields)); } }
public void SetDefaultConnection() { // Fallback to 'Default' for backwards compatibility var loginType = HelperMethods.GetAppSettingsValue("LoginType", true) ?? "Default"; CrmConnection connection; CrmConnection adminConnection; switch (loginType) { case "Default": connection = UsernamePasswordCrmConnection.FromAppConfig(); adminConnection = UsernamePasswordCrmConnection.AdminConnectionFromAppConfig(); break; case "ClientSecret": connection = ClientSecretCrmConnection.CreateFromAppConfig(); adminConnection = ClientSecretCrmConnection.CreateAdminConnectionFromAppConfig(); break; case "Hybrid": connection = HybridCrmConnection.CreateFromAppConfig(); adminConnection = HybridCrmConnection.CreateAdminConnectionFromAppConfig(); break; // Implementations can add their own 'LoginType'. If this is done, then this method shouldn't do anything default: return; } GlobalTestingContext.ConnectionManager.SetAdminConnection(adminConnection); GlobalTestingContext.ConnectionManager.SetCurrentConnection(connection); }
public UserDetails GetDetails() { return(new UserDetails { Username = HelperMethods.GetAppSettingsValue("Username", true), Password = HelperMethods.GetAppSettingsValue("Password", true) }); }
public string GetConnectionString() { var authType = HelperMethods.GetAppSettingsValue("AuthType", true); var clientId = HelperMethods.GetAppSettingsValue("ClientId", true); var clientSecret = HelperMethods.GetAppSettingsValue("ClientSecret", true); var url = HelperMethods.GetAppSettingsValue("Url", true); return(ToCrmClientString(authType, url, clientId, clientSecret)); }
public string GetConnectionString() { var authType = HelperMethods.GetAppSettingsValue("AuthType", true); var userName = HelperMethods.GetAppSettingsValue("Username", true); var password = HelperMethods.GetAppSettingsValue("Password", true); var url = HelperMethods.GetAppSettingsValue("Url", true); return(ToCrmClientString(authType, url, userName, password)); }
private int GetLanguageCode() { if (!int.TryParse(HelperMethods.GetAppSettingsValue("LanguageCode"), out int lcid)) { throw new TestExecutionException(Constants.ErrorCodes.LANGUAGECODE_MUST_BE_INTEGER); } return(lcid); }
public SeleniumTestingContext(CrmTestingContext crmContext) { _crmContext = crmContext; BrowserOptions = new BrowserOptions() { CleanSession = true, StartMaximized = true, UCITestMode = true, }; CurrentApp = HelperMethods.GetAppSettingsValue("AppName", true); }
public void SetDefaultConnection() { var details = new UserDetails { Username = HelperMethods.GetAppSettingsValue("Username", true), Password = HelperMethods.GetAppSettingsValue("Password", true), }; if (!string.IsNullOrEmpty(details.Username) && !string.IsNullOrEmpty(details.Password)) { GlobalTestingContext.ConnectionManager.SetAdminConnection(details); GlobalTestingContext.ConnectionManager.SetCurrentConnection(details); } }
public SeleniumTestingContext(CrmTestingContext crmContext) { _crmContext = crmContext; BrowserOptions = new BrowserOptions() { CleanSession = true, DriversPath = null, StartMaximized = true, PrivateMode = true, UCITestMode = true, }; CurrentApp = HelperMethods.GetAppSettingsValue("AppName", true); BrowserOptions.Headless = Convert.ToBoolean(HelperMethods.GetAppSettingsValue("Headless", true, "false")); }
public void SetDefaultConnection() { var authType = HelperMethods.GetAppSettingsValue("AuthType", true); CrmConnection connection; CrmConnection adminConnection; if (authType.Equals("ClientSecret", StringComparison.InvariantCultureIgnoreCase)) { connection = ClientSecretCrmConnection.CreateFromAppConfig(); adminConnection = ClientSecretCrmConnection.CreateAdminConnectionFromAppConfig(); } else { connection = UsernamePasswordCrmConnection.FromAppConfig(); adminConnection = UsernamePasswordCrmConnection.AdminConnectionFromAppConfig(); } GlobalTestingContext.ConnectionManager.SetAdminConnection(adminConnection); GlobalTestingContext.ConnectionManager.SetCurrentConnection(connection); }
public void SetDefaultConnection() { var authType = HelperMethods.GetAppSettingsValue("AuthType", true); dynamic connectionStringHelper; switch (authType) { default: connectionStringHelper = new DefaultConnectionStringHelper(); break; case "ClientSecret": connectionStringHelper = new AppConnectionStringHelper(); break; } if (connectionStringHelper.IsValid()) { GlobalTestingContext.ConnectionManager.SetAdminConnection(connectionStringHelper); GlobalTestingContext.ConnectionManager.SetCurrentConnection(connectionStringHelper); } }
static ObjectConverter() { _dateonlyFormat = HelperMethods.GetAppSettingsValue("DateFormat", false); _datetimeFormat = $"{_dateonlyFormat} {HelperMethods.GetAppSettingsValue("TimeFormat", false)}"; }
public ConnectionManager() { Url = new Uri(HelperMethods.GetAppSettingsValue("Url")); _authType = HelperMethods.GetAppSettingsValue("AuthType"); _connectionCache = new Dictionary <string, ConnectionCache>(); }