Beispiel #1
0
        public void InsertNewVacationRequestTest_F5203_K_1()
        {
            bool Result = false;
            TestDBReset Reset = new TestDBReset();
            ulong VacationRequestID = 100;
            using (SqlConnection connection = new SqlConnection(sqlConnectionString))
            {
                string sqlStatement =
                    "INSERT INTO [dbo].[VacationRequest] VALUES (" + @VacationRequestID +
                    ", @VacationStartDate, @VacationEndDate, @SubmissionDate, @VacationType, @VacationProcessingState, @ModificationDate, @VacationPeriodOverlapNote, @VacationLockPeriodNote, @NetVacationDays, @EmployeeID)";
                using (SqlCommand cmd = new SqlCommand(sqlStatement, connection))
                {
                    cmd.Parameters.AddWithValue("VacationStartDate", "20150301");
                    cmd.Parameters.AddWithValue("VacationEndDate", "20151202");
                    cmd.Parameters.AddWithValue("SubmissionDate", "2015-06-03 00:00:00.000");
                    cmd.Parameters.AddWithValue("VacationType", "Erholungsurlaub");
                    cmd.Parameters.AddWithValue("VacationProcessingState", "genehmigt");
                    cmd.Parameters.AddWithValue("ModificationDate", "2015-06-03 12:25:47.933");
                    cmd.Parameters.AddWithValue("VacationPeriodOverlapNote", 0);
                    cmd.Parameters.AddWithValue("VacationLockPeriodNote", 0);
                    cmd.Parameters.AddWithValue("NetVacationDays", 20);
                    cmd.Parameters.AddWithValue("EmployeeID", "f7bb0ab3-728b-4053-9b83-1b159a9d83a8");

                    try
                    {
                        connection.Open();
                        cmd.ExecuteNonQuery();
                        Result = true;

                    }
                    catch (SqlException e)
                    {
                        {
                            Result = false;
                        }
                    }
                }
            }
            if (Result == true)
            {

                if (Reset.ResetTestDB())
                {
                    Result = true;
                }
                else
                {
                    Result = false;
                }
            }
            bool actual = true;
            Assert.AreEqual(actual, Result);
        }
Beispiel #2
0
        public void UpdateVacationRequestStatusTest_F5081_K_1()
        {
            TestDBReset Reset = new TestDBReset();
            bool Result = false;
            int UpdateVacationRequestStatusboth = 10;
            using (SqlConnection connection = new SqlConnection(sqlConnectionString))
            {
                string sqlStatement = //insert ID like that because of DataType conflicts
                    "UPDATE dbo.VacationRequest SET VacationProcessingState = @VacationProcessingState, ModificationDate = @modificationDate WHERE VacationRequestID = " +
                    UpdateVacationRequestStatusboth + "";
                using (SqlCommand cmd = new SqlCommand(sqlStatement, connection))
                {
                    cmd.Parameters.AddWithValue("VacationProcessingState", "ACHTUNG");
                    cmd.Parameters.AddWithValue("modificationDate", "2050-01-01 01:14:34.020");

                    try
                    {
                        connection.Open();
                        cmd.ExecuteNonQuery(); //insert,delete,update is NonQuery
                        Result = true;
                    }
                    catch (SqlException e) //if failure in Database result = false
                    {
                        {
                            Result = false;
                        }
                    }
                }
            }
            if (Result == true)
            {

                if (Reset.ResetTestDB())
                {
                    Result = true;
                }
                else
                {
                    Result = false;
                }
            }

            bool actual = true;
            Assert.AreEqual(actual, Result);
        }
Beispiel #3
0
        public void UpdateRemainingVacationDaysTest_F5211_K_1()
        {
            bool Result = false;
            TestDBReset Reset = new TestDBReset();
            using (SqlConnection connection = new SqlConnection(sqlConnectionString))
            {
                string sqlStatement =
                    "UPDATE VacationEntitlement SET VacationDayRemaining = @RemainingVacationDays WHERE EmployeeID = @EmployeeID";
                using (SqlCommand cmd = new SqlCommand(sqlStatement, connection))
                {
                    cmd.Parameters.AddWithValue("RemainingVacationDays", 40);
                    cmd.Parameters.AddWithValue("EmployeeID", "1e04bd54-4fb8-4bb8-806c-8ad7b8c90c43");

                    try
                    {
                        connection.Open();
                        cmd.ExecuteNonQuery();
                        Result = true;
                    }
                    catch (SqlException e)
                    {
                        {
                            Result = false;
                        }
                    }
                }
            }
            if (Result == true)
            {

                if (Reset.ResetTestDB())
                {
                    Result = true;
                }
                else
                {
                    Result = false;
                }
            }

            Assert.AreEqual(true, Result);
        }