public async Task DeclineFriendRequestAsyncShouldWorkCorrectly() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var friendRepository = new EfDeletableEntityRepository <Friend>(dbContext); var friendRequestRepository = new EfDeletableEntityRepository <FriendRequest>(dbContext); var newFriendShipRequest = new FriendRequest { SenderId = "5", ReceiverId = "6", Status = FriendRequestStatus.Pending, }; await friendRequestRepository.AddAsync(newFriendShipRequest); await friendRequestRepository.SaveChangesAsync(); var service = new FriendService(friendRequestRepository, friendRepository); var result = service.DeclineFriendRequestAsync("5", "6"); var testResult = friendRequestRepository.All().Where(x => x.SenderId == "5" && x.Status == FriendRequestStatus.Declined).Count(); Assert.Equal(1, testResult); }