public void User_Can_Not_Add_Collections_With_Duplicate_Names()
        {
            // Create a collection with a duplicate name
            // create a new collectionFormViewModel
            var collectionForm = new CollectionFormViewModel()
            {
                Collection = new Collection()
                {
                    UserId           = 1,
                    CategorizationId = 1,
                    Name             = "Monsters",
                    Description      = "HA-HA! The titles match >:)",
                    Pinned           = false,
                    CreationDate     = DateTime.Now - TimeSpan.FromDays(15)
                },

                ProjectCollections = new List <ProjectCollection>()
                {
                    new ProjectCollection()
                    {
                        ProjectId    = 1,
                        CollectionId = 0 // I won't know this until it's made
                    },
                    new ProjectCollection()
                    {
                        ProjectId    = 2,
                        CollectionId = 0 // I won't know this until it's made
                    }
                }
            };

            // Spoof an authenticated user by generating a ClaimsPrincipal
            var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] {
                new Claim(ClaimTypes.NameIdentifier, "FIREBASE_ID_1"),
            }, "TestAuthentication"));

            // Instantiate a real repos
            var collectionRepo = new CollectionRepository(_context);
            var userRepo       = new UserRepository(_context);
            var projColRepo    = new ProjectCollectionRepository(_context);

            // Instantiate a real CollectionController, passing in CollectionRepo
            var controller = new CollectionController(userRepo, collectionRepo, projColRepo);

            controller.ControllerContext             = new ControllerContext(); // Required to create the controller
            controller.ControllerContext.HttpContext = new DefaultHttpContext {
                User = user
            };                                                                                 // Pretend the user is making a request to the controller

            // Attempt to Add collection
            var response = controller.Add(collectionForm);

            // Should return created result
            Assert.IsType <NotFoundResult>(response);
        }
        public void Anonymous_User_Can_Not_Add_Collection()
        {
            // Spoof an authenticated user by generating a ClaimsPrincipal
            var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] {
                new Claim(ClaimTypes.NameIdentifier, "FIREBASE_USER666"),
            }, "TestAuthentication"));

            // create a new collectionFormViewModel
            var collectionForm = new CollectionFormViewModel()
            {
                Collection = new Collection()
                {
                    UserId           = 1,
                    CategorizationId = 1,
                    Name             = "New stuff",
                    Description      = "New lame description.",
                    Pinned           = false,
                    CreationDate     = DateTime.Now - TimeSpan.FromDays(10)
                },

                ProjectCollections = new List <ProjectCollection>()
                {
                    new ProjectCollection()
                    {
                        ProjectId    = 1,
                        CollectionId = 0
                    }
                }
            };

            // Spoof UserController
            var controller = new CollectionController(_fakeUserRepo.Object, _fakeCollectionRepo.Object, _fakeProjColRepo.Object);

            controller.ControllerContext             = new ControllerContext(); // Required to create the controller
            controller.ControllerContext.HttpContext = new DefaultHttpContext {
                User = user
            };                                                                                 // Pretend the user is making a request to the controller

            // Attempt to Get this User's collections
            var response = controller.Add(collectionForm);

            // Returns Ok
            Assert.IsType <NotFoundResult>(response);
            // Verify we never called the repo method
            _fakeCollectionRepo.Verify(r => r.Add(It.IsAny <Collection>()), Times.Never());
        }