public async Task DenyKitchenInvite_ValidKitchen_ReturnsOKAndInviteDenied()
        {
            List <long> myKitchenIds = _userManager.TestUser.KitchenUser.Select(u => u.KitchenId).ToList();
            Kitchen     notMyKitchen = _context.KitchenUser.Where(u => myKitchenIds.Contains(u.KitchenId) == false).FirstOrDefault()?.Kitchen;

            PantryPlannerUser userSendingInvite = notMyKitchen.KitchenUser
                                                  .Where(k => k.UserId != _userManager.TestUser.Id)
                                                  .FirstOrDefault()?
                                                  .User;

            if (userSendingInvite == null || notMyKitchen == null)
            {
                throw new Exception("user or kitchen is not setup for testing");
            }

            // send invite to test user
            KitchenUserService service = new KitchenUserService(_context);

            service.InviteUserToKitchenByUsername(_userManager.TestUser.UserName, notMyKitchen.KitchenId, userSendingInvite);

            // have test user accept invite
            ActionResult inviteResult = await _controller.DenyKitchenInvite(notMyKitchen.KitchenId);

            Assert.IsType <OkResult>(inviteResult);
            Assert.False(_context.KitchenUser.Any(k => k.KitchenId == notMyKitchen.KitchenId && k.UserId == _userManager.TestUser.Id));
        }
        public KitchenUserServiceUnitTest()
        {
            _testUser = InMemoryDataGenerator.TestUser;
            _context  = InMemoryDataGenerator.CreateAndInitializeInMemoryDatabaseContext(Guid.NewGuid().ToString(), _testUser, insertIngredientData: false);

            _kitchenUserService = new KitchenUserService(_context);
        }
 public KitchenUserController(PantryPlannerContext context, UserManager <PantryPlannerUser> userManager)
 {
     _service     = new KitchenUserService(context);
     _userManager = userManager;
 }