Index: /branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs
===================================================================
--- /branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs	(revision 3959)
+++ /branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs	(revision 3960)
@@ -20,7 +20,5 @@
             userRole.HeuristicLabRole = role;
             userRole.HeuristicLabUser = user;
-
             db.HeuristicLabUserRole.InsertOnSubmit(userRole);
-
           }
         }
Index: /branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs
===================================================================
--- /branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs	(revision 3959)
+++ /branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs	(revision 3960)
@@ -130,10 +130,35 @@
     public void GetRolesForUserTest() {
       HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
-      string username = string.Empty; // TODO: Initialize to an appropriate value
-      string[] expected = null; // TODO: Initialize to an appropriate value
-      string[] actual;
-      actual = target.GetRolesForUser(username);
-      Assert.AreEqual(expected, actual);
-      Assert.Inconclusive("Verify the correctness of this test method.");
+      string dummyUser = "dummyUser";
+      Assert.IsTrue(target.GetRolesForUser(null).Length == 0);
+      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");
+      db.HeuristicLabUsers.InsertOnSubmit(user);
+      db.HeuristicLabUsers.InsertOnSubmit(user2);
+      db.SubmitChanges();
+      target.CreateRole("testRole1");
+      target.CreateRole("testRole2");
+      List<string> users = new List<string>();
+      List<string> roles = new List<string>();
+      users.Add("dummyUser");
+      users.Add("dummyUser2");
+      roles.Add("testRole1");
+      target.AddUsersToRoles(users.ToArray(), roles.ToArray());
+      users.Remove("dummyUser2");
+      roles.Add("testRole2");
+      roles.Remove("testRole1");
+      target.AddUsersToRoles(users.ToArray(), roles.ToArray());
+      string[] rolesForUser = target.GetRolesForUser("dummyUser");
+      Assert.IsTrue(rolesForUser.Length == 2);
+      Assert.IsTrue(rolesForUser.Contains("testRole1"));
+      Assert.IsTrue(rolesForUser.Contains("testRole2"));
+
+      rolesForUser = target.GetRolesForUser("dummyUser2");
+      Assert.IsTrue(rolesForUser.Length == 1);
+      Assert.IsTrue(rolesForUser.Contains("testRole1"));
+
+      
+      
     }
 
@@ -166,12 +191,24 @@
     [TestMethod()]
     public void FindUsersInRoleTest() {
-      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
-      string roleName = string.Empty; // TODO: Initialize to an appropriate value
-      string usernameToMatch = string.Empty; // TODO: Initialize to an appropriate value
-      string[] expected = null; // TODO: Initialize to an appropriate value
-      string[] actual;
-      actual = target.FindUsersInRole(roleName, usernameToMatch);
-      Assert.AreEqual(expected, actual);
-      Assert.Inconclusive("Verify the correctness of this test method.");
+      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider();
+      Assert.IsTrue(target.FindUsersInRole(null, null).Length == 0);
+      Assert.IsTrue(target.FindUsersInRole("dummyRole", null).Length == 0);
+      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");
+      db.HeuristicLabUsers.InsertOnSubmit(user);
+      db.HeuristicLabUsers.InsertOnSubmit(user2);
+      db.SubmitChanges();
+      target.CreateRole("testRole");
+      Assert.IsTrue(target.FindUsersInRole("testRole", "dummyUser").Length == 0);
+      Assert.IsTrue(target.FindUsersInRole("testRole", "dummyUser2").Length == 0);
+      Assert.IsTrue(target.FindUsersInRole("testRole", "dummyUser3").Length == 0);
+
+      target.AddUsersToRoles(new string[] { "dummyUser", "dummyUser2" }, new string[] {"testRole" });
+      Assert.IsTrue(target.FindUsersInRole("testRole", "dummyUser").Length == 2);
+      Assert.IsTrue(target.FindUsersInRole("testRole", "dummyUser2").Length == 1);
+      Assert.IsTrue(target.FindUsersInRole("testRole", "dummyUser3").Length == 0);
+
+
     }
 
@@ -206,7 +243,5 @@
 
     protected int getUserRolesCount() {
-      return db.HeuristicLabUserRole.Count();
-            
-     
+      return db.HeuristicLabUserRole.Count();      
     }
 
