示例#1
0
 public void CreateAndRetrieveRole()
 {
     using (TransactionScope ts = new TransactionScope())
     {
         RoleService service = new RoleService();
         Role role = new Role() { RoleName = "Test Role" };
         service.CreateRole(role);
         Role newRole = service.GetRoleById(role.RoleId);
         Assert.IsNotNull(newRole);
         Assert.AreEqual(role.RoleName, newRole.RoleName);
         Assert.AreEqual(role.RoleId, newRole.RoleId);
     }
 }
示例#2
0
 public void UpdateRole()
 {
     using (TransactionScope ts = new TransactionScope())
     {
         RoleService service = new RoleService();
         Role role = new Role() { RoleName = "Test Role" };
         service.CreateRole(role);
         Role updatedRole = new Role() { RoleId = role.RoleId, RoleName = "New Test Role" };
         service.UpdateRole(updatedRole);
         Role newRole = service.GetRoleById(role.RoleId);
         Assert.IsNotNull(newRole);
         Assert.AreEqual("New Test Role", newRole.RoleName);
     }
 }