public void AspNetGroup_Can_Add_Valid_Changes()
        {
            // Arrange
            AspNetGroupsViewModel AspNetGroupsViewModel = new AspNetGroupsViewModel {
                AspNetGroup = new AspNetGroup {
                    GroupId = 1, Name = "Test", Description = "Test", Active = true
                }, AspNetRolesList = aspNetRolesList
            };

            Mock <ILogger <AspNetGroupsController> > mockLogger = new Mock <ILogger <AspNetGroupsController> >();
            Mock <IIdentityRepository> mockIdentityRepository   = new Mock <IIdentityRepository>();
            Mock <ITempDataDictionary> tempData = new Mock <ITempDataDictionary>();

            AspNetGroupsController controller = new AspNetGroupsController(mockLogger.Object, mockIdentityRepository.Object)
            {
                TempData = tempData.Object
            };

            mockIdentityRepository.Setup(x => x.AddGroup(It.IsAny <AspNetGroup>())).Returns(1);

            // Act
            IActionResult result = controller.Create(AspNetGroupsViewModel, selectedRoles);

            // Assert
            mockIdentityRepository.Verify(m => m.AddGroup(AspNetGroupsViewModel.AspNetGroup));

            Assert.AreEqual("List", (result as RedirectToActionResult).ActionName);
        }
        public void AspNetGroup_Cannot_Add_Invalid_Changes()
        {
            // Arrange
            AspNetGroupsViewModel AspNetGroupsViewModel = new AspNetGroupsViewModel {
                AspNetGroup = new AspNetGroup {
                    GroupId = 1, Name = "Test", Description = "Test", Active = true
                }, AspNetRolesList = aspNetRolesList
            };

            Mock <ILogger <AspNetGroupsController> > mockLogger = new Mock <ILogger <AspNetGroupsController> >();
            Mock <IIdentityRepository> mockIdentityRepository   = new Mock <IIdentityRepository>();

            AspNetGroupsController controller = new AspNetGroupsController(mockLogger.Object, mockIdentityRepository.Object);

            controller.ModelState.AddModelError("error", "error");

            mockIdentityRepository.Setup(x => x.AddGroup(It.IsAny <AspNetGroup>())).Returns(1);

            // Act
            IActionResult result = controller.Create(AspNetGroupsViewModel, selectedRoles);

            // Assert
            mockIdentityRepository.Verify(m => m.AddGroup(It.IsAny <AspNetGroup>()), Times.Never());
        }