Ejemplo n.º 1
0
        public void CheckIfCreateNewServicesWorks()
        {
            // Arrange
            var servicesController = new ServicesController()
            {
                Request = new HttpRequestMessage
                {
                    RequestUri = new Uri("http://localhost:44382/api/services")
                },
                Configuration = new HttpConfiguration()
            };

            try
            {
                // Act
                Service service = new Service()
                {
                    ServiceId = 1, Title = "Test1", Description = "Test1", Duration = 30, Price = 300, Gender = "Male"
                };
                var response = servicesController.CreateNewService(service);

                // Assert
                Assert.IsTrue(response.IsSuccessStatusCode);
                Assert.AreEqual("Test1", service.Title);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 2
0
        private void btn_create_Click(object sender, EventArgs e)
        {
            String malefemale = "";

            if (rb_female.Checked)
            {
                malefemale = "Female";
            }
            else
            {
                malefemale = "Male";
            }
            Service s = new Service(0, txt_service_title.Text, txt_service_description.Text, int.Parse(txt_service_duration.Text), decimal.Parse(txt_service_price.Text), malefemale);

            sc.CreateNewService(s);
            this.Close();
        }