Ejemplo n.º 1
0
        public bool IsValid()
        {
            var clientId     = HelperMethods.GetAppSettingsValue("ClientId", true);
            var clientSecret = HelperMethods.GetAppSettingsValue("ClientSecret", true);

            return(!string.IsNullOrWhiteSpace(clientId) && !string.IsNullOrWhiteSpace(clientSecret));
        }
Ejemplo n.º 2
0
        public bool IsValid()
        {
            var userName = HelperMethods.GetAppSettingsValue("Username", true);
            var password = HelperMethods.GetAppSettingsValue("Password", true);

            return(!string.IsNullOrWhiteSpace(userName) && !string.IsNullOrWhiteSpace(password));
        }
Ejemplo n.º 3
0
        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));
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public UserDetails GetDetails()
 {
     return(new UserDetails
     {
         Username = HelperMethods.GetAppSettingsValue("Username", true),
         Password = HelperMethods.GetAppSettingsValue("Password", true)
     });
 }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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);
 }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
 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"));
 }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
 static ObjectConverter()
 {
     _dateonlyFormat = HelperMethods.GetAppSettingsValue("DateFormat", false);
     _datetimeFormat = $"{_dateonlyFormat} {HelperMethods.GetAppSettingsValue("TimeFormat", false)}";
 }
Ejemplo n.º 15
0
 public ConnectionManager()
 {
     Url              = new Uri(HelperMethods.GetAppSettingsValue("Url"));
     _authType        = HelperMethods.GetAppSettingsValue("AuthType");
     _connectionCache = new Dictionary <string, ConnectionCache>();
 }