Exemple #1
0
        public virtual ServiceMethodList FetchMethods(DbSource dbSource)
        {
            switch (dbSource.ServerType)
            {
            case enSourceType.MySqlDatabase:
            {
                var broker = new MySqlDatabaseBroker();
                return(broker.GetServiceMethods(dbSource));
            }

            case enSourceType.PostgreSQL:
            {
                var broker = new PostgreSqlDataBaseBroker();
                return(broker.GetServiceMethods(dbSource));
            }

            case enSourceType.Oracle:
            {
                var broker = new OracleDatabaseBroker();
                return(broker.GetServiceMethods(dbSource));
            }

            case enSourceType.SQLiteDatabase:
            {
                var broker = new SqliteDatabaseBroker();
                return(broker.GetServiceMethods(dbSource));
            }

            default:
            {
                var broker = new SqlDatabaseBroker();
                return(broker.GetServiceMethods(dbSource));
            }
            }
        }
Exemple #2
0
        public void SqlDatabaseBroker_GetServiceMethods_SqlUserWithValidUsername_GetsMethods()
        {
            var dbSource = SqlServerTestUtils.CreateDev2TestingDbSource();
            var broker   = new SqlDatabaseBroker();
            var result   = broker.GetServiceMethods(dbSource);

            Assert.AreEqual(true, result.Count > 0);
        }
        // ReSharper disable InconsistentNaming
        public void SqlDatabaseBroker_GetServiceMethods_SqlUserWithInvalidUsername_ThrowsLoginFailedException()
        // ReSharper restore InconsistentNaming
        {
            var dbSource = SqlServerTests.CreateDev2TestingDbSource();
            dbSource.UserID = "Billy.Jane";
            dbSource.Password = "******";

            var broker = new SqlDatabaseBroker();
            broker.GetServiceMethods(dbSource);
        }
Exemple #4
0
 public void SqlDatabaseBroker_GetServiceMethods_WindowsUserWithDbAccess_GetsMethods()
 {
     RunAs("IntegrationTester", "DEV2", "I73573r0", () =>
     {
         var dbSource = SqlServerTestUtils.CreateDev2TestingDbSource(AuthenticationType.Windows);
         var broker   = new SqlDatabaseBroker();
         var result   = broker.GetServiceMethods(dbSource);
         Assert.AreEqual(true, result.Count > 0);
     });
 }
Exemple #5
0
 public void SqlDatabaseBroker_GetServiceMethods_WindowsUserWithDbAccess_GetsMethods()
 {
     RunAs("IntegrationTester", "dev2", () =>
     {
         var dbSource = SqlServerTestUtils.CreateDev2TestingDbSource(Depends.EnableDocker?Depends.RigOpsIP:Depends.SVRDEVIP, AuthenticationType.Windows);
         var broker   = new SqlDatabaseBroker();
         var result   = broker.GetServiceMethods(dbSource);
         Assert.AreEqual(true, result.Count > 0);
     });
 }
 // ReSharper disable InconsistentNaming
 public void SqlDatabaseBroker_GetServiceMethods_WindowsUserWithDbAccess_GetsMethods()
 // ReSharper restore InconsistentNaming
 {
     Impersonator.RunAs("IntegrationTester", "DEV2", "I73573r0", () =>
     {
         var dbSource = SqlServerTests.CreateDev2TestingDbSource(AuthenticationType.Windows);
         var broker = new SqlDatabaseBroker();
         var result = broker.GetServiceMethods(dbSource);
         Assert.AreEqual(true, result.Count > 0);
     });
 }
Exemple #7
0
        public void SqlDatabaseBroker_GetServiceMethods_SqlUserWithInvalidUsername_ThrowsLoginFailedException()
        {
            var dbSource = SqlServerTestUtils.CreateDev2TestingDbSource(Depends.EnableDocker?Depends.RigOpsIP:Depends.SVRDEVIP);

            dbSource.UserID   = "Billy.Jane";
            dbSource.Password = "******";

            var broker = new SqlDatabaseBroker();

            broker.GetServiceMethods(dbSource);
        }
        public void SqlDatabaseBroker_GetServiceMethods_SqlUserWithInvalidUsername_ThrowsLoginFailedException()
        {
            var dbSource = SqlServerTestUtils.CreateDev2TestingDbSource(_containerOps.Container.IP, int.Parse(_containerOps.Container.Port));

            dbSource.UserID   = "Billy.Jane";
            dbSource.Password = "******";

            var broker = new SqlDatabaseBroker();

            broker.GetServiceMethods(dbSource);
        }
Exemple #9
0
        // ReSharper disable InconsistentNaming
        public void SqlDatabaseBroker_GetServiceMethods_SqlUserWithInvalidUsername_ThrowsLoginFailedException()
        // ReSharper restore InconsistentNaming
        {
            var dbSource = SqlServerTests.CreateDev2TestingDbSource();

            dbSource.UserID   = "Billy.Jane";
            dbSource.Password = "******";

            var broker = new SqlDatabaseBroker();

            broker.GetServiceMethods(dbSource);
        }
Exemple #10
0
 public void SqlDatabaseBroker_GetServiceMethods_WindowsUserWithoutDbAccess_ThrowsLoginFailedException()
 {
     RunAs("NoDBAccessTest", "DEV2", "One23456", () =>
     {
         var dbSource = SqlServerTestUtils.CreateDev2TestingDbSource(AuthenticationType.Windows);
         var broker   = new SqlDatabaseBroker();
         try
         {
             broker.GetServiceMethods(dbSource);
             Assert.Fail();
         }
         catch (Exception ex)
         {
             Assert.IsNotNull(ex);
             Assert.IsInstanceOfType(ex, typeof(SqlException));
             Assert.AreEqual("Login failed for user 'DEV2\\NoDBAccessTest'.", ex.Message);
         }
     });
 }
        // ReSharper disable InconsistentNaming
        public void SqlDatabaseBroker_GetServiceMethods_WindowsUserWithoutDbAccess_ThrowsLoginFailedException()
        // ReSharper restore InconsistentNaming
        {

            Impersonator.RunAs("NoDBAccessTest", "DEV2", "One23456", () =>
            {
                var dbSource = SqlServerTests.CreateDev2TestingDbSource(AuthenticationType.Windows);
                var broker = new SqlDatabaseBroker();
                try
                {
                    broker.GetServiceMethods(dbSource);
                    Assert.Fail();
                }
                catch(Exception ex)
                {
                    Assert.IsNotNull(ex);
                    Assert.IsInstanceOfType(ex, typeof(SqlException));
                    Assert.AreEqual("Login failed for user 'DEV2\\NoDBAccessTest'.", ex.Message);
                }
            });
        }
 // ReSharper disable InconsistentNaming
 public void SqlDatabaseBroker_GetServiceMethods_SqlUserWithValidUsername_GetsMethods()
 // ReSharper restore InconsistentNaming
 {
     var dbSource = SqlServerTests.CreateDev2TestingDbSource();
     var broker = new SqlDatabaseBroker();
     var result = broker.GetServiceMethods(dbSource);
     Assert.AreEqual(true, result.Count > 0);
 }