Ejemplo n.º 1
0
        public void AddCustomer()
        {
            //Arrange
            var        expectedFirstName = "John";
            var        expectedLastName  = "Smith";
            var        expectedPhone     = "1234567890";
            int        addSuccess        = 1;
            MainScreen form          = new MainScreen();
            var        createControl = form.GetType().GetMethod("CreateControl", BindingFlags.Instance | BindingFlags.NonPublic);

            createControl.Invoke(form, new object[] { true });

            //Act - set up values
            //result = 1 if new customer is added, result = 0 if customer can not be added
            int actualResult = form.AddCustomer(expectedFirstName, expectedLastName, expectedPhone);

            //Assertion - The expected output given the known inputs
            Assert.Equal(addSuccess, actualResult);
        }