public async Task UpdateObjectAsync_Success_UpdatedObjectReturned(Dto dto) { //Arrange var result = await section.InsertAsync(new Dto { Name = "TestFlightEx1", From = 1, To = 7, AirlineId = 1, FlightTypeId = 1, ReturnFlightSameAirlineRequired = true, AlternativeSearch = false, FlightDuration = 1, AirplaneModelId = 1, StatusId = 1 }); var resultId = result.Id ?? default; Dto actualResult = null; //Act try { actualResult = await section.UpdateAsync(resultId, dto); await section.DeleteAsync(resultId); //Clear database dto.Id = actualResult.Id; dto.IsReturnFlight = false; } catch { await section.DeleteAsync(resultId); //Clear database } var expectedResult = dto.ToExpectedObject(); //Assert expectedResult.ShouldEqual(actualResult); }
public async Task CreateObjectAsync_Success_CreatedObjectReturned(Dto dto) { //Act var actualResult = await section.InsertAsync(dto); var resultId = actualResult.Id ?? default; await section.DeleteAsync(resultId); //Clear database dto.Id = actualResult.Id; var expectedResult = dto.ToExpectedObject(); //Assert expectedResult.ShouldEqual(actualResult); }