Esempio n. 1
0
            public async Task WhenGetRelationshipsGetsCalled()
            {
                Setup();

                AuthService.Setup(service => service.AuthorizeSelf(It.IsAny <string>(), It.IsAny <Guid>())).Returns(true);
                RelationshipsRepository.Setup(repository => repository.GetRelationshipsByIdAndType(
                                                  It.IsAny <Guid>(), It.IsAny <RelationshipType>())).ReturnsAsync(_relationships);

                _result = await RelationshipsController.GetRelationships(_userId, RelationshipTypeId);
            }
Esempio n. 2
0
            public async Task WhenAreAlreadyFriendsGetsCalled()
            {
                Setup();

                RelationshipsRepository.Setup(repository =>
                                              repository.GetRelationshipByIdsAndType(It.IsAny <Guid>(), It.IsAny <Guid>(),
                                                                                     It.IsAny <RelationshipType>())).ReturnsAsync(new Relationship());

                _result = await RelationshipsService.AreAlreadyFriends(_userOneId, _userTwoId);
            }
Esempio n. 3
0
            public async Task WhenAddFriendGetsCalled()
            {
                Setup();

                _relationship = new Relationship(_userOneId, _userTwoId, RelationshipType.Friend);

                RelationshipsRepository.Setup(repository => repository.CreateRelationship(It.IsAny <Relationship>()))
                .Callback <Relationship>(rel => _usedRelationship = rel);

                await RelationshipsService.AddFriend(_userOneId, _userTwoId);
            }