public void CreatePerson_Successful( string firstName, string lastName, string heightText, int heightInInches) { PersonProcessor processor = new PersonProcessor(null); PersonModel expected = new PersonModel { FirstName = firstName, LastName = lastName, HeightText = heightText, HeightInInches = heightInInches, Id = 0 }; var actual = processor.CreatePerson(firstName, lastName, heightText); Assert.Equal(expected.Id, actual.Id); Assert.Equal(expected.FirstName, actual.FirstName); Assert.Equal(expected.LastName, actual.LastName); Assert.Equal(expected.HeightText, actual.HeightText); Assert.Equal(expected.HeightInInches, actual.HeightInInches); }
private void button1_Click(object sender, EventArgs e) { string email = tbEmail.Text; int id = int.Parse(tbID.Text); string fname = tbFN.Text; string lname = tbLN.Text; string phone = tbPhoneNumber.Text; PersonProcessor.CreatePerson(id, fname, lname, email, phone); resetForm(); }
public void CreatePerson_ThrowsException(string firstName, string lastName, string heightText, string expectedInvalidParameter) { PersonProcessor processor = new PersonProcessor(null); var ex = Record.Exception(() => processor.CreatePerson(firstName, lastName, heightText)); Assert.NotNull(ex); Assert.IsType <ArgumentException>(ex); if (ex is ArgumentException argEx) { Assert.Equal(expectedInvalidParameter, argEx.ParamName); } }