public int ChangeConsignmentStatus(NewConsignmentStatus ncs) { SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand("usp_changeConsignmentStatus"); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@ConsignmentID", ncs.ConsignmentID)); command.Parameters.Add(new SqlParameter("@NewStatus", ncs.NewConsignmentStatusInt)); command.Connection = connection; connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(command); DataTable table = new DataTable(); adapter.Fill(table); connection.Close(); if (table.Rows[0][0].ToString() == ncs.NewConsignmentStatusInt.ToString()) { return(1); } else { return(0); } }
public void ChangeConsignmentStatusTest() { NewConsignmentStatus ncs = new NewConsignmentStatus(); ncs.ConsignmentID = GetConsignmentID(); ncs.NewConsignmentStatusInt = 1; int result = controller.ChangeConsignmentStatus(ncs); Assert.AreEqual(result, 1); }