Exemple #1
0
        public void T2_View_Returns_Expected_Values_Programmaticaly()
        {
            using (SqlConnection connection = new SqlConnection(DbInit.GetDbConnectionString()))
            {
                connection.Open();

                ResetTable(connection);

                List <View> results = DbViews.GetViewValues(connection).ToList();

                Compare(results, GetAllUser()).Should().BeTrue();
            }
        }
        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 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);
            }
        }