public async Task ShouldGetContactDetails(bool hasThirdContact) { _returnedContacts.Add(Contact1); _returnedContacts.Add(Contact2); if (hasThirdContact) { _returnedContacts.Add(Contact3); } var result = (await _contactDetailsController.GetContactDetailsAsync(SolutionId).ConfigureAwait(false)) as ObjectResult; result.StatusCode.Should().Be(200); var contact = result.Value as GetContactDetailsResult; contact.Contact1.FirstName.Should().BeEquivalentTo(Contact1.FirstName); contact.Contact1.LastName.Should().BeEquivalentTo(Contact1.LastName); contact.Contact1.DepartmentName.Should().BeEquivalentTo(Contact1.Department); contact.Contact1.EmailAddress.Should().BeEquivalentTo(Contact1.Email); contact.Contact1.PhoneNumber.Should().BeEquivalentTo(Contact1.PhoneNumber); contact.Contact2.FirstName.Should().BeEquivalentTo(Contact2.FirstName); contact.Contact2.LastName.Should().BeEquivalentTo(Contact2.LastName); contact.Contact2.DepartmentName.Should().BeEquivalentTo(Contact2.Department); contact.Contact2.EmailAddress.Should().BeEquivalentTo(Contact2.Email); contact.Contact2.PhoneNumber.Should().BeEquivalentTo(Contact2.PhoneNumber); _mockMediator.Verify(m => m.Send(It.Is <GetContactDetailBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()), Times.Once); }
public async Task ShouldGetContactDetails(bool hasThirdContact) { returnedContacts.Add(Contact1); returnedContacts.Add(Contact2); if (hasThirdContact) { returnedContacts.Add(Contact3); } var result = await contactDetailsController.GetContactDetailsAsync(SolutionId) as ObjectResult; Assert.NotNull(result); result.StatusCode.Should().Be(StatusCodes.Status200OK); var contact = result.Value as GetContactDetailsResult; Assert.NotNull(contact); contact.Contact1.FirstName.Should().BeEquivalentTo(Contact1.FirstName); contact.Contact1.LastName.Should().BeEquivalentTo(Contact1.LastName); contact.Contact1.DepartmentName.Should().BeEquivalentTo(Contact1.Department); contact.Contact1.EmailAddress.Should().BeEquivalentTo(Contact1.Email); contact.Contact1.PhoneNumber.Should().BeEquivalentTo(Contact1.PhoneNumber); contact.Contact2.FirstName.Should().BeEquivalentTo(Contact2.FirstName); contact.Contact2.LastName.Should().BeEquivalentTo(Contact2.LastName); contact.Contact2.DepartmentName.Should().BeEquivalentTo(Contact2.Department); contact.Contact2.EmailAddress.Should().BeEquivalentTo(Contact2.Email); contact.Contact2.PhoneNumber.Should().BeEquivalentTo(Contact2.PhoneNumber); mockMediator.Verify(m => m.Send( It.Is <GetContactDetailBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>())); }