Ejemplo n.º 1
0
        public void Should_return_JSON_string_when_doctor_is_created()
        {
            dynamic actual = null;

            try
            {
                // Given
                dynamic expected = CreateExpectedResponseForCreate();
                Browser browser  = CreateBrowser();

                // When
                BrowserResponse result = browser.Post("/doctors/",
                                                      with =>
                {
                    with.HttpRequest();
                });

                actual = XUnitDoctorsHelper.ToDynamic(result.Body.AsString());

                // Then
                XUnitDoctorsHelper.AssertDoctorIgnoreId(expected,
                                                        actual);
            }
            finally
            {
                if (actual != null)
                {
                    var doctorId = ( long )actual ["Id"].Value;

                    DeleteDoctorById(doctorId);
                }
            }
        }
Ejemplo n.º 2
0
        public void Should_return_JSON_string_when_doctor_is_created_for_put()
        {
            dynamic actual = null;

            try
            {
                // Given
                IDoctorForResponse model    = CreateModelForPutTest();
                dynamic            expected = CreateExpectedResponseForPutTest();
                Browser            browser  = CreateBrowser();

                // When
                BrowserResponse result = browser.Put("/doctors/",
                                                     with =>
                {
                    with.JsonBody(model);
                });

                actual = XUnitDoctorsHelper.ToDynamic(result.Body.AsString());

                // Then
                XUnitDoctorsHelper.AssertDoctorIgnoreId(expected,
                                                        actual);
            }
            finally
            {
                if (actual != null)
                {
                    int id = Convert.ToInt32(actual ["Id"].Value);

                    DeleteDoctorById(id);
                }
            }
        }