- Timestamp:
- 07/06/10 16:01:19 (14 years ago)
- Location:
- branches/HeuristicLab.Services.Authentication Prototype/UnitTests
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabMembershipProviderTest.cs
r3992 r4002 67 67 [TestMethod()] 68 68 public void RequiresUniqueEmailTest() { 69 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();// TODO: Initialize to an appropriate value69 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 70 70 bool actual; 71 71 actual = target.RequiresUniqueEmail; … … 78 78 [TestMethod()] 79 79 public void RequiresQuestionAndAnswerTest() { 80 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();// TODO: Initialize to an appropriate value80 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 81 81 bool actual; 82 82 actual = target.RequiresQuestionAndAnswer; … … 89 89 [TestMethod()] 90 90 public void PasswordStrengthRegularExpressionTest() { 91 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value91 MembershipProvider target = Membership.Provider; 92 92 string actual; 93 93 actual = target.PasswordStrengthRegularExpression; … … 100 100 [TestMethod()] 101 101 public void PasswordFormatTest() { 102 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value102 MembershipProvider target = Membership.Provider; 103 103 MembershipPasswordFormat actual; 104 104 actual = target.PasswordFormat; … … 111 111 [TestMethod()] 112 112 public void PasswordAttemptWindowTest() { 113 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();// TODO: Initialize to an appropriate value113 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 114 114 int actual; 115 115 actual = target.PasswordAttemptWindow; … … 122 122 [TestMethod()] 123 123 public void MinRequiredPasswordLengthTest() { 124 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();// TODO: Initialize to an appropriate value124 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 125 125 int actual; 126 126 actual = target.MinRequiredPasswordLength; … … 133 133 [TestMethod()] 134 134 public void MinRequiredNonAlphanumericCharactersTest() { 135 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();// TODO: Initialize to an appropriate value135 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 136 136 int actual; 137 137 actual = target.MinRequiredNonAlphanumericCharacters; … … 144 144 [TestMethod()] 145 145 public void MaxInvalidPasswordAttemptsTest() { 146 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value146 MembershipProvider target = Membership.Provider; 147 147 int actual; 148 148 actual = target.MaxInvalidPasswordAttempts; … … 155 155 [TestMethod()] 156 156 public void EnablePasswordRetrievalTest() { 157 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value157 MembershipProvider target = Membership.Provider; 158 158 bool actual; 159 159 actual = target.EnablePasswordRetrieval; … … 166 166 [TestMethod()] 167 167 public void EnablePasswordResetTest() { 168 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();// TODO: Initialize to an appropriate value168 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 169 169 bool actual; 170 170 actual = target.EnablePasswordReset; … … 177 177 [TestMethod()] 178 178 public void ApplicationNameTest() { 179 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value179 MembershipProvider target = Membership.Provider; 180 180 string expected = string.Empty; // TODO: Initialize to an appropriate value 181 181 string actual; … … 191 191 [TestMethod()] 192 192 public void ValidateUserTest() { 193 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();193 MembershipProvider target = Membership.Provider; 194 194 MembershipCreateStatus status; 195 195 target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); … … 202 202 [TestMethod()] 203 203 public void ValidateUserTestEncrypted() { 204 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();204 MembershipProvider target = Membership.Provider; 205 205 NameValueCollection config = new NameValueCollection(); 206 206 config.Add("passwordFormat", "Encrypted"); 207 target.Initialize("", config);208 207 MembershipCreateStatus status; 209 208 target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); … … 216 215 [TestMethod()] 217 216 public void ValidateUserTestHashed() { 218 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); 219 NameValueCollection config = new NameValueCollection(); 220 config.Add("passwordFormat", "Hashed"); 221 target.Initialize("", config); 217 MembershipProvider target = Membership.Provider; 222 218 MembershipCreateStatus status; 223 219 target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); … … 230 226 [TestMethod()] 231 227 public void UpdateUserTest() { 232 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value228 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 233 229 MembershipUser user = null; // TODO: Initialize to an appropriate value 234 230 target.UpdateUser(user); … … 242 238 public void LockUserTest() 243 239 { 244 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();240 MembershipProvider target = Membership.Provider; 245 241 MembershipCreateStatus status; 246 HeuristicLabUser user = (HeuristicLabUser)target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status);242 Persistence.HeuristicLabMembershipUser user = (Persistence.HeuristicLabMembershipUser)target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); 247 243 user.UnlockUser(); 248 Assert.IsFalse(user.Locked); 249 user.LockUser(); 250 Assert.IsTrue(user.Locked); 251 Assert.Inconclusive("Verify the correctness of this test method."); 252 } 253 254 /// <summary> 255 ///A test for UnlockUser 256 ///</summary> 257 [TestMethod()] 258 public void UnlockUserTest() 259 { 260 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); 261 MembershipCreateStatus status; 262 HeuristicLabUser user = (HeuristicLabUser)target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); 263 user.LockUser(); 264 Assert.IsTrue(user.Locked); 265 user.UnlockUser(); 266 Assert.IsFalse(user.Locked); 267 Assert.Inconclusive("Verify the correctness of this test method."); 268 } 244 HeuristicLabUser dbUser = db.HeuristicLabUsers.Single(u => u.UserName == "testname"); 245 Assert.IsFalse(dbUser.Locked); 246 Assert.IsTrue(dbUser.Locked); 247 248 } 249 250 269 251 270 252 /// <summary> … … 273 255 [TestMethod()] 274 256 public void ResetPasswordTest() { 275 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value257 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 276 258 string username = string.Empty; // TODO: Initialize to an appropriate value 277 259 string answer = string.Empty; // TODO: Initialize to an appropriate value … … 288 270 [TestMethod()] 289 271 public void GetUserNameByEmailTest() { 290 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value272 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 291 273 string email = string.Empty; // TODO: Initialize to an appropriate value 292 274 string expected = string.Empty; // TODO: Initialize to an appropriate value … … 302 284 [TestMethod()] 303 285 public void GetUserTest1() { 304 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value286 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 305 287 object providerUserKey = null; // TODO: Initialize to an appropriate value 306 288 bool userIsOnline = false; // TODO: Initialize to an appropriate value … … 317 299 [TestMethod()] 318 300 public void GetUserTest() { 319 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value301 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 320 302 string username = string.Empty; // TODO: Initialize to an appropriate value 321 303 bool userIsOnline = false; // TODO: Initialize to an appropriate value … … 332 314 [TestMethod()] 333 315 public void GetPasswordTest() { 334 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value316 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 335 317 string username = string.Empty; // TODO: Initialize to an appropriate value 336 318 string answer = string.Empty; // TODO: Initialize to an appropriate value … … 347 329 [TestMethod()] 348 330 public void GetNumberOfUsersOnlineTest() { 349 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value331 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 350 332 int expected = 0; // TODO: Initialize to an appropriate value 351 333 int actual; … … 362 344 [TestMethod()] 363 345 public void GetAllUsersTest() { 364 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();346 MembershipProvider target = Membership.Provider; 365 347 MembershipCreateStatus status; 366 348 int totalRecords; … … 375 357 376 358 int j = 0; 377 foreach (HeuristicLab User user in users) {359 foreach (HeuristicLabMembershipUser user in users) { 378 360 Assert.Equals("User " + j, user.UserName); 379 361 j++; … … 388 370 [TestMethod()] 389 371 public void FindUsersByNameTest() { 390 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value372 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 391 373 string usernameToMatch = string.Empty; // TODO: Initialize to an appropriate value 392 374 int pageIndex = 0; // TODO: Initialize to an appropriate value … … 407 389 [TestMethod()] 408 390 public void FindUsersByEmailTest() { 409 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); // TODO: Initialize to an appropriate value391 MembershipProvider target = Membership.Provider; // TODO: Initialize to an appropriate value 410 392 string emailToMatch = string.Empty; // TODO: Initialize to an appropriate value 411 393 int pageIndex = 0; // TODO: Initialize to an appropriate value … … 427 409 public void DeleteUserTest() { 428 410 // insert new user 429 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();411 MembershipProvider target = Membership.Provider; 430 412 MembershipCreateStatus status; 431 413 target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); … … 443 425 public void CreateUserTest() { 444 426 // create user 445 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();427 MembershipProvider target = Membership.Provider; 446 428 MembershipCreateStatus status; 447 429 target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); … … 480 462 481 463 // change data and check again 482 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();464 MembershipProvider target = Membership.Provider; 483 465 // gibt zwar true zurück, was schon mal gut ist 484 466 Assert.IsTrue(target.ChangePasswordQuestionAndAnswer("testname", "INIT", "newquestion", "newanswer")); … … 504 486 505 487 // change data and check again 506 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider();488 MembershipProvider target = Membership.Provider; 507 489 Assert.IsTrue(target.ChangePassword("testname", "INIT", "newPassword")); 508 490 // hat nix gemacht!! :( … … 511 493 } 512 494 513 /// <summary> 514 ///A test for HeuristicLabMembershipProvider Constructor 515 ///</summary> 516 [TestMethod()] 517 public void HeuristicLabMembershipProviderConstructorTest() { 518 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); 519 Assert.Inconclusive("TODO: Implement code to verify target"); 520 } 521 495 522 496 [TestMethod()] 523 497 public void NoDuplicateUserNameTest() { -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs
r4000 r4002 383 383 } 384 384 } 385 } //HeuristicLabRoleProviderTest 385 } 386 -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/UnitTests.csproj
r3976 r4002 61 61 <Compile Include="HeuristicLabMembershipProviderTest.cs" /> 62 62 <Compile Include="HeuristicLabRoleProviderTest.cs" /> 63 <Compile Include="HeuristicLabUserTest.cs" />64 63 <Compile Include="Properties\AssemblyInfo.cs" /> 65 64 <Compile Include="Service References\ServiceManagementRemote\Reference.cs"> -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/app.config
r3976 r4002 37 37 38 38 </system.serviceModel> 39 <system.web> 40 <compilation debug="true" /> 41 </system.web> 39 <system.web> 40 <compilation debug="true" /> 41 <membership defaultProvider="HeuristiclabMemberShipProvider" userIsOnlineTimeWindow="15"> 42 <providers> 43 <clear/> 44 <add 45 name="HeuristiclabMemberShipProvider" 46 type="Service.Provider.HeuristicLabMembershipProvider, Service" 47 passwordFormat= "Hashed"/> 48 </providers> 49 </membership> 50 </system.web> 51 42 52 <system.serviceModel> 43 53 <behaviors> -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/service/HeuristicLabManagementServiceTest.cs
r3976 r4002 27 27 } 28 28 } 29 30 [TestMethod()]31 29 public void TestCreateRoleTest() { 32 30 new ServiceManagementRemote.AuthorizationManagementServiceClient().CreateRole("myRole", true);
Note: See TracChangeset
for help on using the changeset viewer.