public async Task GetAppointmentAsync_ValidId_ShouldReturnExpectedAppointment() { // Arrange var existingAppointment = new GetAppointmentPayload { Id = Guid.NewGuid().ToString(), }; var expectedResponseContent = new StringContent(JsonConvert.SerializeObject(existingAppointment, this.fixture.JsonSerializerSettings)); var expectedResponse = new HttpResponseMessage { Content = expectedResponseContent, }; var appointmentApi = this.fixture.GetAppointmentApi(expectedResponse); var getAppointmentByIdResponse = new GetAppointmentByIdResponse(); // Act Func <Task> act = async() => getAppointmentByIdResponse = await appointmentApi.GetAppointmentByIdAsync(existingAppointment.Id); // Assert await act.Should().NotThrowAsync(); getAppointmentByIdResponse.Id.Should().Be(existingAppointment.Id); }
public async Task GetAppointmentAsync_ExistingAppointment_ShouldReturnExpectedAppointment() { // Arrange await this.fixture.ClearFactroInstanceAsync(); var appointmentApi = this.fixture.GetService <IAppointmentApi>(); var existingAppointment = await this.fixture.CreateTestAppointmentAsync(appointmentApi); var getAppointmentByIdResponse = new GetAppointmentByIdResponse(); // Act Func <Task> act = async() => getAppointmentByIdResponse = await appointmentApi.GetAppointmentByIdAsync(existingAppointment.Id); // Assert await act.Should().NotThrowAsync(); getAppointmentByIdResponse.Should().BeEquivalentTo(existingAppointment); await this.fixture.ClearFactroInstanceAsync(); }