public Response DeleteById(int id) { IFlightAssignedToGate response = m_InformationFinder.Delete(id); return(response == null ? HttpStatusCode.NotFound : AsJson(response)); }
public IFlightAssignedToGate Delete(int id) { IFlightAssignedToGate entity = m_Repository.FindById(id); m_Repository.Remove(entity); return(entity); }
private IFlightAssignedToGate CreateItem(Browser browser, int id = 1) { IFlightAssignedToGate model = CreateModelForPutTest(id); BrowserResponse result = browser.Post(BasePath, with => { with.JsonBody(model); }); var response = result.Body.DeserializeJson <DataAccess.FlightAssignedToGate>(); return(response); }
private void AssertFlightAssignedToGate(IFlightAssignedToGate expected, IFlightAssignedToGate actual) { Console.WriteLine("Comparing FlightAssignedToGate with id {0} and {1}...", expected.Id, actual.Id); Assert.AreEqual(expected.GateId, actual.GateId, "GateId"); Assert.AreEqual(expected.FlightId, actual.FlightId, "FlightId"); }
public void Should_return_status_OK_when_item_with_id_exists() { // Given Browser browser = CreateBrowser(); IFlightAssignedToGate item = CreateItem(browser); // When BrowserResponse result = browser.Get(BasePath + item.Id, with => { with.HttpRequest(); }); // Then Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); }
public void Should_return_JSON_string_when_item_is_deleted() { // Given Browser browser = CreateBrowser(); IFlightAssignedToGate expected = CreateItem(browser); // When BrowserResponse result = browser.Delete(BasePath + expected.Id, with => { with.HttpRequest(); }); var actual = result.Body.DeserializeJson <DataAccess.FlightAssignedToGate>(); // Then AssertFlightAssignedToGate(expected, actual); }
public void Should_return_status_OK_when_list_requested() { // Given Browser browser = CreateBrowser(); IFlightAssignedToGate one = CreateItem(browser, 1); IFlightAssignedToGate two = CreateItem(browser, 2); // When BrowserResponse result = browser.Get(BasePath, with => { with.HttpRequest(); }); // Then Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); }
public void Should_return_JSON_string_when_existing_item_is_updated() { // Given Browser browser = CreateBrowser(); IFlightAssignedToGate expected = CreateItem(browser); expected.GateId = 2; expected.FlightId = 22; // When BrowserResponse result = browser.Put(BasePath, with => { with.JsonBody(expected); }); var actual = result.Body.DeserializeJson <DataAccess.FlightAssignedToGate>(); // Then AssertFlightAssignedToGate(expected, actual); }
public void Should_return_JSON_string_when_list_requested() { // Given Browser browser = CreateBrowser(); IFlightAssignedToGate one = CreateItem(browser, 1); IFlightAssignedToGate two = CreateItem(browser, 2); // When BrowserResponse result = browser.Get(BasePath, with => { with.HttpRequest(); }); var actual = result.Body.DeserializeJson <DataAccess.FlightAssignedToGate[]>(); // Then Assert.AreEqual(2, actual.Length); }
public Response Save(IFlightAssignedToGate flightAssignedToGate) { IFlightAssignedToGate saved = m_InformationFinder.Save(flightAssignedToGate); return(AsJson(saved)); }
public IFlightAssignedToGate Save(IFlightAssignedToGate entity) { m_Repository.Save(entity); return(entity); }
public IFlightAssignedToGate FindById(int id) { IFlightAssignedToGate entity = m_Repository.FindById(id); return(entity); }