Index: /branches/HeuristicLab.Services.Authentication Prototype/HeuristicLab.Services.Authentication Prototyp.sln
===================================================================
--- /branches/HeuristicLab.Services.Authentication Prototype/HeuristicLab.Services.Authentication Prototyp.sln	(revision 3977)
+++ /branches/HeuristicLab.Services.Authentication Prototype/HeuristicLab.Services.Authentication Prototyp.sln	(revision 3978)
@@ -11,4 +11,5 @@
 	ProjectSection(SolutionItems) = preProject
 		HeuristicLab.Services.Authentication Prototyp.vsmdi = HeuristicLab.Services.Authentication Prototyp.vsmdi
+		HeuristicLab.Services.Authentication Prototyp1.vsmdi = HeuristicLab.Services.Authentication Prototyp1.vsmdi
 		HeuristicLab.Services.Authentication Prototyp2.vsmdi = HeuristicLab.Services.Authentication Prototyp2.vsmdi
 		LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
@@ -17,5 +18,5 @@
 Global
 	GlobalSection(TestCaseManagementSettings) = postSolution
-		CategoryFile = HeuristicLab.Services.Authentication Prototyp2.vsmdi
+		CategoryFile = HeuristicLab.Services.Authentication Prototyp1.vsmdi
 	EndGlobalSection
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
Index: /branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUserRole.cs
===================================================================
--- /branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUserRole.cs	(revision 3977)
+++ /branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUserRole.cs	(revision 3978)
@@ -7,5 +7,13 @@
   partial class HeuristicLabUserRole {
     public override bool Equals(object obj) {
-      return ((HeuristicLabUserRole)obj).HeuristicLabRole.Equals(this.HeuristicLabRole) && ((HeuristicLabUserRole)obj).HeuristicLabUser.Equals(this.HeuristicLabUser);
+        if(this.ID == null ^ ((HeuristicLabUserRole)obj).ID == null )
+        {
+          return false;
+        }
+        else if (this.ID == null && ((HeuristicLabUserRole)obj).ID == null)
+        {
+         return base.Equals(obj);
+        }
+        return ((HeuristicLabUserRole)obj).ID.Equals(this.ID);
     }
   }
Index: /branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs
===================================================================
--- /branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs	(revision 3977)
+++ /branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs	(revision 3978)
@@ -126,5 +126,20 @@
 
     public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) {
-      throw new NotImplementedException();
+
+      DataClassesDataContext context = DatabaseUtil.createDataClassesDataContext();
+
+      foreach (string userName in usernames) {
+        if (userName != null && context.HeuristicLabUsers.Count(u => u.UserName == userName) > 0) {
+          Persistence.HeuristicLabUser user = context.HeuristicLabUsers.Single(u => u.UserName == userName);
+          foreach (Persistence.HeuristicLabUserRole userRole in user.HeuristicLabUserRoles) {
+            if (roleNames.Contains(userRole.HeuristicLabRole.RoleName)) {
+              context.HeuristicLabUserRole.DeleteOnSubmit(userRole);
+              //deleteList.Add(userRole);
+            }//if
+          }//foreach
+        }//if
+      }//foreach
+      context.SubmitChanges();
+      context.Dispose();
     }
 
Index: /branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs
===================================================================
--- /branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs	(revision 3977)
+++ /branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs	(revision 3978)
@@ -90,9 +90,30 @@
     [TestMethod()]
     public void RemoveUsersFromRolesTest() {
-      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
-      string[] usernames = null; // TODO: Initialize to an appropriate value
-      string[] roleNames = null; // TODO: Initialize to an appropriate value
-      target.RemoveUsersFromRoles(usernames, roleNames);
-      Assert.Inconclusive("A method that does not return a value cannot be verified.");
+
+      //creates users dkhan,hmayer,bfarka (with AddUsersToRolesTest())
+      //and add all these users to groups admin and users
+      AddUsersToRolesTest();
+      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); 
+      string[] users = new string[2];
+      string[] roles = new string[1];
+
+      //remove hmayer from role admin
+      users[0] = "hmayr";
+      roles[0] = "admin";
+
+
+      //before removing, check if all three users exits correctly in admin group
+      Assert.IsTrue((target.GetRolesForUser("hmayr").ToList()).Contains(roles[0]));
+      Assert.IsTrue((target.GetRolesForUser("dkhan").ToList()).Contains(roles[0]));
+      Assert.IsTrue((target.GetRolesForUser("bfarka").ToList()).Contains(roles[0]));
+
+      //remmove hmayr from  admin group
+      target.RemoveUsersFromRoles(users, roles);
+
+      //final check
+      Assert.IsTrue((target.GetRolesForUser("dkhan").ToList()).Contains(roles[0]));
+      Assert.IsTrue((target.GetRolesForUser("bfarka").ToList()).Contains(roles[0]));
+      Assert.IsFalse((target.GetRolesForUser("hmayr").ToList()).Contains(roles[0]));
+
     }
 
@@ -132,6 +153,6 @@
       Assert.IsTrue(target.GetUsersInRole(null).Length == 0);
       Assert.IsTrue(target.GetUsersInRole(dummyRole).Length == 0);
-      Persistence.HeuristicLabUser user = new Persistence.HeuristicLabUser("dummyUser", "foo", "foo", "foo");
-      Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("dummyUser2", "foo", "foo", "foo");
+      Persistence.HeuristicLabUser user = new Persistence.HeuristicLabUser("dummyUser", "foo1", "foo", "foo");
+      Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("dummyUser2", "foo2", "foo", "foo");
       db.HeuristicLabUsers.InsertOnSubmit(user);
       db.HeuristicLabUsers.InsertOnSubmit(user2);
@@ -174,5 +195,5 @@
       Assert.IsTrue(target.GetRolesForUser(dummyUser).Length == 0);
       Persistence.HeuristicLabUser user = new Persistence.HeuristicLabUser("dummyUser", "foo", "foo", "foo");
-      Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("dummyUser2", "foo", "foo", "foo");
+      Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("dummyUser2", "foo2", "foo", "foo");
       db.HeuristicLabUsers.InsertOnSubmit(user);
       db.HeuristicLabUsers.InsertOnSubmit(user2);
@@ -212,5 +233,5 @@
       roleNames.Add("Pascal");
       roleNames.Add("Java");
-      roleNames.Add("Pascal");
+      roleNames.Add("c++");
       roleNames.Add("VisalBasic");
       foreach (string s in roleNames) {
@@ -235,5 +256,5 @@
       Assert.IsTrue(target.FindUsersInRole(null, "dummyUser").Length == 0);
       Persistence.HeuristicLabUser user = new Persistence.HeuristicLabUser("dummyUser", "foo", "foo", "foo");
-      Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("dummyUser2", "foo", "foo", "foo");
+      Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("dummyUser2", "foo2", "foo", "foo");
       db.HeuristicLabUsers.InsertOnSubmit(user);
       db.HeuristicLabUsers.InsertOnSubmit(user2);
@@ -294,7 +315,7 @@
       Dictionary<string, Persistence.HeuristicLabUser> users = new Dictionary<string, Persistence.HeuristicLabUser>();
       List<string> roles = new List<string>();
-      users.Add("dkhan", new Persistence.HeuristicLabUser("dkhan", "foo", "password", "comment"));
-      users.Add("hmayr", new Persistence.HeuristicLabUser("hmayr", "foo", "password", "comment"));
-      users.Add("bfarka", new Persistence.HeuristicLabUser("bfarka", "foo", "password", "comment"));
+      users.Add("dkhan", new Persistence.HeuristicLabUser("dkhan", "foo1", "password", "comment"));
+      users.Add("hmayr", new Persistence.HeuristicLabUser("hmayr", "foo2", "password", "comment"));
+      users.Add("bfarka", new Persistence.HeuristicLabUser("bfarka", "foo3", "password", "comment"));
 
       roles.Add("admin");
@@ -314,5 +335,5 @@
       db.SubmitChanges();
       target.AddUsersToRoles(users.Keys.ToArray(), roles.ToArray());
-      Assert.IsTrue(getUserRolesCount() == (roles.Count + users.Count));
+      Assert.IsTrue(getUserRolesCount() == (roles.Count * users.Count));
 
     }
