public async Task GetCompanyAsync_ValidId_ShouldReturnExpectedCompany() { // Arrange var existingCompany = new GetCompanyPayload { Id = Guid.NewGuid().ToString(), }; var expectedResponseContent = new StringContent(JsonConvert.SerializeObject(existingCompany, this.fixture.JsonSerializerSettings)); var expectedResponse = new HttpResponseMessage { Content = expectedResponseContent, }; var companyApi = this.fixture.GetCompanyApi(expectedResponse); var getCompanyByIdResponse = new GetCompanyByIdResponse(); // Act Func <Task> act = async() => getCompanyByIdResponse = await companyApi.GetCompanyByIdAsync(existingCompany.Id); // Assert await act.Should().NotThrowAsync(); getCompanyByIdResponse.Id.Should().Be(existingCompany.Id); }
public async Task GetCompanyAsync_ExistingCompany_ShouldReturnExpectedCompany() { // Arrange await this.fixture.ClearFactroInstanceAsync(); var companyApi = this.fixture.GetService <ICompanyApi>(); var existingCompany = await this.fixture.CreateTestCompanyAsync(companyApi); var getCompanyByIdResponse = new GetCompanyByIdResponse(); // Act Func <Task> act = async() => getCompanyByIdResponse = await companyApi.GetCompanyByIdAsync(existingCompany.Id); // Assert await act.Should().NotThrowAsync(); getCompanyByIdResponse.Should().BeEquivalentTo(existingCompany); await this.fixture.ClearFactroInstanceAsync(); }