Ejemplo n.º 1
0
        public async Task FriendRequestExists_RequestIsNotCreated_ReturnFalse()
        {
            var options = InMemoryDbHelper.SetUpInMemoryDb("Request_Is_Not_Created");

            using (var dbContext = new ReactorDbContext(options))
            {
                dbContext.Set <Friend>();
            }

            var service = new FriendService(new FriendRepository(new ReactorDbContext(options)), _userService.Object);

            var result = await service.FriendRequestExistsAsync(It.IsAny <string>(), It.IsAny <string>());

            Assert.That(result, Is.False);
        }
Ejemplo n.º 2
0
        public async Task FriendRequestExists_RequestIsCreatedByRequestedToUser_ReturnTrue()
        {
            var options = InMemoryDbHelper.SetUpInMemoryDb("Request_Is_Created_By_RequestedToUser");

            using (var dbContext = new ReactorDbContext(options))
            {
                await dbContext.Set <Friend>().AddRangeAsync(new List <Friend>
                {
                    _notapprovedfriend
                });

                await dbContext.SaveChangesAsync();
            }

            var service = new FriendService(new FriendRepository(new ReactorDbContext(options)), _userService.Object);

            var result = await service.FriendRequestExistsAsync(_currentUser.Id, _otherUser1.Id);

            Assert.That(result, Is.True);
        }