public void Should_return_JSON_string_when_person_is_created() { dynamic actual = null; try { // Given dynamic expected = CreateExpectedResponseForCreate(); Browser browser = CreateBrowser(); // When BrowserResponse result = browser.Post("/person/", with => { with.HttpRequest(); }); actual = XUnitPersonsHelper.ToDynamic(result.Body.AsString()); // Then XUnitPersonsHelper.AssertPersonIgnoreId(expected, actual); } finally { if (actual != null) { var id = ( long )actual ["Id"].Value; DeleteDoctorById(id); } } }
public void Should_return_JSON_string_when_person_is_created_for_put() { dynamic actual = null; try { // Given IPersonForResponse model = CreateModelForPutTest(); dynamic expected = CreateExpectedResponseForPutTest(); Browser browser = CreateBrowser(); // When BrowserResponse result = browser.Put("/person/", with => { with.JsonBody(model); }); actual = XUnitPersonsHelper.ToDynamic(result.Body.AsString()); // Then XUnitPersonsHelper.AssertPersonIgnoreId(expected, actual); } finally { if (actual != null) { int id = Convert.ToInt32(actual ["Id"].Value); DeleteDoctorById(id); } } }