Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
            }
        }