public void T2_Call_FindStudent_Proc(string param, int success, string[] arraySuccess)
        {
            using (SqlConnection connection = new SqlConnection(DbInit.GetDbConnectionString()))
            {
                connection.Open();

                List <string> results = DbStoredProcedures.FindStudent(param, connection).ToList();
                results.Count.Should().Be(success);
                if (success > 0)
                {
                    foreach (string suc in arraySuccess)
                    {
                        Assert.Contains(suc, results);
                    }
                }
            }
        }
        public void T1_Create_Proc_FindStudent_With_Specific_String_In_Their_Name()
        {
            using (SqlConnection connection = new SqlConnection(DbInit.GetConnectionString()))
            {
                connection.Open();

                ScriptExecutor exe = new ScriptExecutor();
                exe.ScriptExe(DbStoredProcedures.StoredProceduresFindStudent(), connection);

                string     cmdText   = @"USE itiSchoolDB IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'FindStudent') SELECT 1 ELSE SELECT 0";
                SqlCommand DateCheck = new SqlCommand(cmdText, connection);
                int        x         = Convert.ToInt32(DateCheck.ExecuteScalar());
                x.Should().Be(1);

                // Check if already Exist
                exe.ScriptExe(DbStoredProcedures.StoredProceduresFindStudent(), connection);
            }
        }
        public void T4_Call_UpStudent_Programmatically(string[] redoublants, int nbValidated, string[] validatedNames, int sizeTable)
        {
            using (SqlConnection connection = new SqlConnection(DbInit.GetDbConnectionString()))
            {
                connection.Open();

                ResetTable(connection);

                var results = DbStoredProcedures.UpStudent(redoublants, connection).ToList();
                results.Count.Should().Be(nbValidated);
                foreach (string suc in validatedNames)
                {
                    Assert.Contains(suc, results);
                }

                // Check if validated students have been deleted
                ScriptExecutor exe = new ScriptExecutor();
                exe.ScriptReader("use itiSchoolDB SELECT * from Student", connection, "Name").Count().Should().Be(sizeTable);
            }
        }
        public void T3_Create_Proc_UpStudent(string[] redoublants, int nbValidated, string[] validatedNames, int sizeTable)
        {
            using (SqlConnection connection = new SqlConnection(DbInit.GetConnectionString()))
            {
                connection.Open();

                ScriptExecutor exe = new ScriptExecutor();
                exe.ScriptExe(DbStoredProcedures.StoredProceduresUpStudent(), connection);

                string     cmdText   = @"USE itiSchoolDB IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'UpStudent') SELECT 1 ELSE SELECT 0";
                SqlCommand DateCheck = new SqlCommand(cmdText, connection);
                int        x         = Convert.ToInt32(DateCheck.ExecuteScalar());
                x.Should().Be(1);

                // Check if already Exist
                exe.ScriptExe(DbStoredProcedures.StoredProceduresUpStudent(), connection);

                ResetTable(connection);

                // Test if proc is working
                StringBuilder str = new StringBuilder("use itiSchoolDB");
                str.Append(" DECLARE @Students AS StudentList");
                for (int i = 0; i < redoublants.Length; i++)
                {
                    str.Append(" INSERT INTO @Students VALUES ('" + redoublants[i] + "')");
                }
                str.Append(" EXEC UpStudent @Students");

                List <string> results = exe.ScriptReader(str.ToString(), connection, "Name").ToList();
                results.Count.Should().Be(nbValidated);
                foreach (string suc in validatedNames)
                {
                    Assert.Contains(suc, results);
                }

                // Check if validated students have been deleted
                exe.ScriptReader("use itiSchoolDB SELECT * from Student", connection, "Name").Count().Should().Be(sizeTable);
            }
        }