- Timestamp:
- 06/26/10 12:51:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs
r3960 r3963 12 12 private TestContext testContextInstance; 13 13 private const string TEST_ROLE_NAME = "testRole"; 14 private const string TEST_USER_NAME = "testUser"; 14 15 /// <summary> 15 16 ///Gets or sets the test context which provides … … 96 97 97 98 /// <summary> 98 /// A test for IsUserInRole99 /// test if user is in Role (positive and negative Assertion) 99 100 ///</summary> 100 101 [TestMethod()] 101 102 public void IsUserInRoleTest() { 102 HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value 103 string username = string.Empty; // TODO: Initialize to an appropriate value 104 string roleName = string.Empty; // TODO: Initialize to an appropriate value 105 bool expected = false; // TODO: Initialize to an appropriate value 106 bool actual; 107 actual = target.IsUserInRole(username, roleName); 108 Assert.AreEqual(expected, actual); 109 Assert.Inconclusive("Verify the correctness of this test method."); 103 HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value 104 Dictionary<string, Persistence.HeuristicLabUser> users = new Dictionary<string, Persistence.HeuristicLabUser>(); 105 List<string> roles = new List<string>(); 106 users.Add("mholper", new Persistence.HeuristicLabUser("mholper", "foo", "password", "comment")); 107 108 roles.Add("admin"); 109 roles.Add("users"); 110 foreach (string role in roles) 111 { 112 target.CreateRole(role); 113 } 114 foreach (Persistence.HeuristicLabUser user in users.Values) 115 { 116 db.HeuristicLabUsers.InsertOnSubmit(user); 117 } 118 db.SubmitChanges(); 119 string[] rolesToTest = new string[1]; 120 rolesToTest[0] = "admin"; 121 target.AddUsersToRoles(users.Keys.ToArray(), rolesToTest); // roles.ToArray()); 122 Assert.IsTrue(target.IsUserInRole("mholper", "admin")); 123 Assert.IsFalse(target.IsUserInRole("mholper", "user")); 110 124 } 111 125
Note: See TracChangeset
for help on using the changeset viewer.