public void Save_NewPermissionValidWithExistingControllerNameAndActionName_IdInstanceUpdated()
        {
            var permission = new Permission() { ActionName = "Action 2", ControllerName = "controller" };

            m_target.Save(permission);
            m_unitOfWork.Commit();

            Assert.AreEqual(2, permission.Id);
            Assert.AreEqual(5, m_repository.CountAll());
        }
        public void Save_OldPermissionValid_Updated()
        {
            var permission = new Permission() { Id = 3, ActionName = "Permission 4 - UPDATED", ControllerName = "Descrição 4 - UPDATED" };

            m_target.Save(permission);
            m_unitOfWork.Commit();

            Assert.AreEqual(3, permission.Id);
            Assert.AreEqual(5, m_repository.CountAll());
            Assert.AreEqual("Permission 4 - UPDATED", m_target.GetById(3).ActionName);
            Assert.AreEqual("Descrição 4 - UPDATED", m_target.GetById(3).ControllerName);
        }
        public void Save_NewPermissionValid_Created()
        {
            var permission = new Permission() { ActionName = "nome", ControllerName = "controller" };

            m_target.Save(permission);
            m_unitOfWork.Commit();

            Assert.AreEqual(6, permission.Id);
            Assert.AreEqual(6, m_repository.CountAll());
        }
        public void Save_PermissionInvalid_Exception()
        {
            var permission = new Permission() { ActionName = "", ControllerName = "" };

            ExceptionAssert.IsThrowing(typeof(SpecificationNotSatisfiedException), () =>
            {
                m_target.Save(permission);
            });

            Assert.AreEqual(0, permission.Id);
            Assert.AreEqual(5, m_repository.CountAll());
        }