コード例 #1
0
        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);
        }
コード例 #2
0
        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>();
        }
コード例 #3
0
        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");
        }