public void AddCallTest1() { DateTime date; date = DateTime.Today; IntercityCallModel model = new IntercityCallModel("Smith", "(495)111221", date, 60, 0.40); AddIntercityCall call = new AddIntercityCall(); call.Add(model, connection); string price = model.Price.ToString().Replace(",", "."); var cmdText = $"SELECT * FROM IntercityCalls WHERE [Phone] = '{model.Phone}' " + $"AND [Surname] = '{model.Surname}' " + $"AND [Duration] = {model.Duration}" + $"AND [Price] = {price}"; connection.Open(); OleDbCommand TestCommand = new OleDbCommand(cmdText, connection); if (TestCommand.ExecuteReader().HasRows) { connection.Close(); Assert.Pass(); } else { connection.Close(); Assert.Fail("В таблице нет записи"); } }
public void Setup() { connection.Open(); OleDbCommand TruncateCommand = new OleDbCommand("DELETE FROM IntercityCalls", connection); TruncateCommand.ExecuteNonQuery(); connection.Close(); AddIntercityCall call = new AddIntercityCall(); IntercityCallModel model; DateTime date = DateTime.Today; for (int Item = 0; Item < 100; Item++) { model = new IntercityCallModel($"TestSur{Item}", $"{Item}", date, 60, 0.4); call.Add(model, connection); } }