public void TestUpdateRole() { _authorizationService = new AbilityAuthorizationService(new UserRepository(), new RoleRepository(), new AbilityRepository()); _authorizationService.AddRole(_role1); _authorizationService.AddRole(_role2); IEnumerable<IRole> roles = _authorizationService.GetRoles(); Assert.AreEqual(2, roles.Count()); Assert.AreEqual(_role1, roles.First()); Assert.AreEqual(_role2, roles.Last()); _role2.Name = "RoleUpdate"; _authorizationService.UpdateRole(_role2); roles = _authorizationService.GetRoles(); Assert.AreEqual(2, roles.Count()); Assert.AreEqual(_role1, roles.First()); Assert.AreEqual(_role2, roles.Last()); Assert.AreEqual("RoleUpdate", roles.Last().Name); }