public int ChangeSKURange(SKURange range) { SqlConnection connection = new SqlConnection(Connection.connectionString()); SqlCommand command = new SqlCommand("usp_changeSKURange"); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@ConsignmentID", range.ConsignmentID)); command.Parameters.Add(new SqlParameter("@SKUMin", range.Min)); command.Parameters.Add(new SqlParameter("@SKUMax", range.Max)); 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() == range.Min.ToString() && table.Rows[0][1].ToString() == range.Max.ToString()) { return(1); } else { return(0); } }
public void ChangeSKURangeTest() { SKURange range = new SKURange(); range.ConsignmentID = int.Parse(GetConsignmentID()); range.Min = "1"; range.Max = "1"; int result = controller.ChangeSKURange(range); Assert.AreEqual(result, 1); }