Exemplo n.º 1
0
        public void RoleModel_Should_Be_Created_By_Role()
        {
            var role = RoleTestData.GetAdminRole();

            var roleModel = roleBuilder.BuildModel(role);

            Assert.AreEqual(role.Name, roleModel.Name);
            Assert.AreEqual(role.Code, roleModel.Code);
            Assert.AreEqual(role.Id, roleModel.Id);
        }
Exemplo n.º 2
0
        public void Role_Update_Existing_With_Existing_Code_Role_Should_Throw_Exception()
        {
            using (var context = new PayrollContext(IntergrationTestsSetup.ContextOptions))
            {
                var unitOfWork = new UnitOfWork(context);
                var role       = RoleTestData.GetAdminRole();

                role.Code = "Super_Admin";

                unitOfWork.Role.Update(role);
                unitOfWork.Save();
            }
        }
Exemplo n.º 3
0
        public void Role_Delete_Existing_Role_Should_Succeed()
        {
            using (var context = new PayrollContext(IntergrationTestsSetup.ContextOptions))
            {
                var unitOfWork = new UnitOfWork(context);
                var role       = RoleTestData.GetAdminRole();
                var roleCount  = unitOfWork.Role.CountEntities();

                unitOfWork.Role.Delete(role);
                unitOfWork.Save();

                Assert.IsTrue(roleCount - 1 == unitOfWork.Role.CountEntities());
            }
        }
Exemplo n.º 4
0
        public void Role_Update_Existing_Role_Should_Succeed()
        {
            using (var context = new PayrollContext(IntergrationTestsSetup.ContextOptions))
            {
                var unitOfWork = new UnitOfWork(context);
                var role       = RoleTestData.GetAdminRole();

                role.Name = "Admin User";

                unitOfWork.Role.Update(role);
                unitOfWork.Save();

                Assert.IsTrue(role.Id == 2);
                Assert.IsTrue(role.Name.Equals("Admin User"));
            }
        }