Esempio n. 1
0
        public void GFSqlConnector_Method_CheckTearDown()
        {
            Core.GFSqlConnector TestSQLConnector = new Core.GFSqlConnector("testappAPIKEY", "testuserAPIKEY", this._SQLServer, this._DBName, true);
            //Generate some test data
            TestSQLConnector.GenerateTestData();
            //Tear the data down
            TestSQLConnector.TearDownData();

            //Check the test data has been removed from the database
            TestSQLConnector.Open();                                                                                                                                 //Open Connection
            SqlCommand Cmd = TestSQLConnector.SQLCommand("SELECT [row_count] = COUNT(*) FROM [simsig].[TSIM] WHERE [testdata_id] = @testdata_id", CommandType.Text); //Generate SqlCommand

            Cmd.Parameters.Add(new SqlParameter("@testdata_id", TestSQLConnector.TestDataID));
            SqlDataReader DataReader         = Cmd.ExecuteReader();
            int           SimulationRowCount = -1; //Variable to store the simulation row count

            while (DataReader.Read())
            {
                SimulationRowCount = DataReader.GetInt32(0);
            }

            TestSQLConnector.Close(); //Close Connection

            Assert.Equal(0, SimulationRowCount);
        }
Esempio n. 2
0
        public void GFSqlConnector_Connection_CheckSessionContext()
        {
            Core.GFSqlConnector TestSQLConnector = new Core.GFSqlConnector("testappAPIKEY", "testuserAPIKEY", this._SQLServer, this._DBName);

            TestSQLConnector.Open();                                                                                                             //Open Connection
            SqlCommand    cmd    = TestSQLConnector.SQLCommand("SELECT test = CONVERT(INT,SESSION_CONTEXT(N'application'));", CommandType.Text); //Generate SqlCommand
            SqlDataReader reader = cmd.ExecuteReader();                                                                                          //Execute

            int ApplicationID = 0;                                                                                                               //Variable to store AppID from GF Microsoft SQL

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    ApplicationID = reader.GetInt32(0);
                }
            }
            reader.Close();
            TestSQLConnector.Close(); //Close Connection

            Assert.Equal(2, ApplicationID);
        }