コード例 #1
0
        public async void RemoveFriendRequestRoute_Test()
        {
            // Arrange
            var user   = CreatePerson();
            var friend = CreatePerson();

            var acceptedFriends = new List <Person>();

            _personRepository
            .Setup(x => x.Single(p => p.Name == user.Name))
            .ReturnsAsync(user);
            _personRepository
            .Setup(x => x.Single(p => p.Name == friend.Name))
            .ReturnsAsync(friend);

            _friendRepository
            .Setup(x =>
                   x.DeleteFriendsWithRelationshipAsync(
                       It.IsAny <Person>(),
                       It.IsAny <Person>()))
            .Verifiable();

            var personController = new PersonController(_personRepository.Object, _mapper, _emailHelper.Object, _tokenClass.Object);
            var friendController = new FriendController(_personRepository.Object, _friendRepository.Object, _mapper);

            // Act
            var result = await friendController.RemoveFriend(user.Name, friend.Name);

            var okResult = result as OkObjectResult;

            // Assert
            Assert.True(okResult != null);
            Assert.Equal(200, okResult.StatusCode);
        }