public void WhenPersonHasPersonalRelationshipsReturnsRelationshipsMappedToType() { var(person, _, _) = PersonalRelationshipsHelper.CreatePersonWithPersonalRelationships(); _mockDatabaseGateway.Setup(x => x.GetPersonWithPersonalRelationshipsByPersonId(It.IsAny <long>(), It.IsAny <bool>())).Returns(person); var result = _relationshipsUseCase.ExecuteGet(person.Id); result.PersonalRelationships.Should().HaveCount(3); }
public void WhenDetailsIsNullDoesNotThrowNullReferenceException() { var(person, otherPersons, personalRelationships) = PersonalRelationshipsHelper.CreatePersonWithPersonalRelationships(); person.PersonalRelationships[0].Details = null; person.PersonalRelationships[1].Details = null; person.PersonalRelationships[2].Details = null; Action act = () => personalRelationships.ToResponse(); act.Should().NotThrow <NullReferenceException>(); }
public void WhenThereArePersonalRelationshipsReturnsAnObjectForEachExistingType() { var(person, _, personalRelationships) = PersonalRelationshipsHelper.CreatePersonWithPersonalRelationships(); var response = personalRelationships.ToResponse(); response.Should().HaveCount(3); response.Should().Contain(pr => pr.Type == "parent"); response.Should().Contain(pr => pr.Type == "child"); response.Should().Contain(pr => pr.Type == "neighbour"); }