public void ConnectToDB_SqlServer_IncorrectDbParams_ReturnThrow()
        {
            Action action = () => step.ConnectToDB_SqlServer(dbConnectionString, dbConnectionParams);

            action.Should()
            .Throw <ConnectSqlException>()
            .Which.Message.Contains($"Connection failed. Connection with parameters: {Helpers.Message.CreateMessage(dbConnectionParams)}");
            //action.Should()
            //    .Throw<ConnectSqlException>()
            //     .WithMessage("*A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.*");
        }
Ejemplo n.º 2
0
        public void ConnectToDB_SqlServer_DbParamsIsNull_ReturnThrow()
        {
            dbConnectionParams = new SqlConnectionStringBuilder {
                InitialCatalog = "", DataSource = "", UserID = "", Password = "", ConnectTimeout = 1, ConnectRetryCount = 1
            };

            Action action = () => step.ConnectToDB_SqlServer(dbConnectionString, dbConnectionParams);

            action.Should()
            .Throw <ConnectSqlException>();
        }
Ejemplo n.º 3
0
        public void ConnectToDB_SqlServer_DbParamsIsNull_ReturnThrow()
        {
            dbConnectionParams = new DbConnectionParams()
            {
                Database = "", Source = "", Login = "", Password = "", Timeout = 0
            };

            Action action = () => step.ConnectToDB_SqlServer(dbConnectionString, dbConnectionParams);

            action.Should()
            .Throw <Xunit.Sdk.XunitException>();
        }