コード例 #1
0
        public void SetUp()
        {
            _mockDatabaseGateway          = new Mock <IDatabaseGateway>();
            _personalRelationshipsUseCase = new PersonalRelationshipsUseCase(_mockDatabaseGateway.Object);

            _mockDatabaseGateway.Setup(x => x.GetPersonalRelationshipTypeByDescription(_typeInRequest.Description))
            .Returns(_typeInRequest);

            _request = PersonalRelationshipsHelper.CreatePersonalRelationshipRequest(type: _typeInRequest.Description);

            _person      = TestHelpers.CreatePerson(_request.PersonId);
            _otherPerson = TestHelpers.CreatePerson(_request.OtherPersonId);

            _typeInExistingRelationship = PersonalRelationshipsHelper.CreatePersonalRelationshipType("partner");

            _relationship = PersonalRelationshipsHelper.CreatePersonalRelationship(_person, _otherPerson, _typeInExistingRelationship);
            _rel_details  = PersonalRelationshipsHelper.CreatePersonalRelationshipDetail(_relationship.Id, "some details for the relationship");
        }
        public void SetUp()
        {
            _mockDatabaseGateway          = new Mock <IDatabaseGateway>();
            _personalRelationshipsUseCase = new PersonalRelationshipsUseCase(_mockDatabaseGateway.Object);

            _mockDatabaseGateway.Setup(x => x.GetPersonalRelationshipTypeByDescription(_typeInRequest.Description))
            .Returns(_typeInRequest);

            var typeInExistingRelationship = PersonalRelationshipsHelper.CreatePersonalRelationshipType("partner");

            _mockDatabaseGateway.Setup(x => x.GetPersonalRelationshipTypeByDescription(typeInExistingRelationship.Description))
            .Returns(typeInExistingRelationship);

            _request = PersonalRelationshipsHelper.CreatePersonalRelationshipRequest(type: _typeInRequest.Description);

            _person      = TestHelpers.CreatePerson(_request.PersonId);
            _otherPerson = TestHelpers.CreatePerson(_request.OtherPersonId);

            var personalRelationship = PersonalRelationshipsHelper.CreatePersonalRelationship(_person, _otherPerson, typeInExistingRelationship);

            _person.PersonalRelationships = new List <PersonalRelationship>()
            {
                personalRelationship
            };

            _mockDatabaseGateway.Setup(x => x.GetPersonsByListOfIds(It.IsAny <List <long> >()))
            .Returns(new List <Person>()
            {
                _person, _otherPerson
            });

            _mockDatabaseGateway.Setup(x => x.GetPersonWithPersonalRelationshipsByPersonId(It.IsAny <long>(), It.IsAny <bool>()))
            .Returns(_person);

            _mockDatabaseGateway.Setup(x => x.CreatePersonalRelationship(It.IsAny <CreatePersonalRelationshipRequest>()))
            .Returns(personalRelationship);

            _mockDatabaseGateway.Setup(x => x.GetWorkerByEmail(It.IsAny <string>()))
            .Returns(TestHelpers.CreateWorker(email: _request.CreatedBy));
        }