public void DeleteListReturns401WhenUserDoesntOwnList()
        {
            var options = new DbContextOptionsBuilder <ReadingListApiContext>()
                          .UseInMemoryDatabase("delete_returns_401")
                          .Options;

            using (var context = new ReadingListApiContext(options))
            {
                ReadingList readingList      = new ReadingListFixture().ReadingList();
                User        user             = new UserFixture().User();
                User        unauthorizedUser = new User
                {
                    Email  = "unauthorized test email",
                    Avatar = "unauthorized test avatar",
                };
                user.ReadingLists.Add(readingList);
                context.Users.AddRange(new List <User>()
                {
                    user, unauthorizedUser
                });
                context.SaveChanges();

                SessionHelperStub     session    = new SessionHelperStub(unauthorizedUser);
                ReadingListController controller = new ReadingListController(context, session);

                var result = controller.Delete(readingList.ReadingListId);

                Assert.IsType <NotFoundResult>(result);
            }
        }
        public void DeletesAReadingList()
        {
            var options = new DbContextOptionsBuilder <ReadingListApiContext>()
                          .UseInMemoryDatabase("deletes_a_reading_list")
                          .Options;

            using (var context = new ReadingListApiContext(options))
            {
                User        user        = new UserFixture().User();
                ReadingList readingList = new ReadingListFixture().ReadingList();
                user.ReadingLists.Add(readingList);
                context.Users.Add(user);
                context.SaveChanges();

                SessionHelperStub     session    = new SessionHelperStub(user);
                ReadingListController controller = new ReadingListController(context, session);

                Guid readingListId = readingList.ReadingListId;

                var result = controller.Delete(readingList.ReadingListId);

                Assert.Equal(0, context.ReadingLists.Count());
                Assert.Equal(null, context.ReadingLists.Where(r => r.ReadingListId == readingListId).FirstOrDefault());
            }
        }