- Timestamp:
- 06/28/10 21:09:36 (14 years ago)
- Location:
- branches/HeuristicLab.Services.Authentication Prototype/UnitTests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabMembershipProviderTest.cs
r3965 r3974 7 7 using System.Linq; 8 8 using System.Collections.Generic; 9 using System.Data.SqlClient; 9 10 10 11 namespace UnitTests { … … 216 217 public void ValidateUserTestHashed() { 217 218 HeuristicLabMembershipProvider target = new HeuristicLabMembershipProvider(); 218 NameValueCollection 219 NameValueCollection config = new NameValueCollection(); 219 220 config.Add("passwordFormat", "Hashed"); 220 target.Initialize("", config);221 target.Initialize("", config); 221 222 MembershipCreateStatus status; 222 223 target.CreateUser("testname", "newPassword", "testemail", "testquestion", "testanswer", true, null, out status); … … 490 491 Assert.Inconclusive("TODO: Implement code to verify target"); 491 492 } 493 494 [TestMethod()] 495 public void NoDuplicateUserNameTest() { 496 try { 497 Persistence.HeuristicLabUser user = new Persistence.HeuristicLabUser("duplicateName", "mail", "myQuestion", "myComment"); 498 db.HeuristicLabUsers.InsertOnSubmit(user); 499 Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("duplicateName", "mail2", "myQuestion2", "myComment2"); 500 db.HeuristicLabUsers.InsertOnSubmit(user2); 501 db.SubmitChanges(); 502 Assert.Fail(); 503 } 504 catch (SqlException) { 505 //swallowing Exception because it is expected that a SQL Exception is thrown 506 } 507 } 508 [TestMethod()] 509 public void NoDuplicateEmailTest() { 510 try { 511 Persistence.HeuristicLabUser user = new Persistence.HeuristicLabUser("duplicateName", "mail", "myQuestion", "myComment"); 512 db.HeuristicLabUsers.InsertOnSubmit(user); 513 Persistence.HeuristicLabUser user2 = new Persistence.HeuristicLabUser("duplicateName2", "mail", "myQuestion2", "myComment2"); 514 db.HeuristicLabUsers.InsertOnSubmit(user2); 515 db.SubmitChanges(); 516 Assert.Fail(); 517 } 518 catch (SqlException) { 519 //swallowing Exception because it is expected that a SQL Exception is thrown 520 } 521 } 492 522 } 493 523 } -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs
r3967 r3974 3 3 using System.Linq; 4 4 using System.Collections.Generic; 5 using System.Data.SqlClient; 5 6 namespace UnitTests { 6 7 /// <summary> … … 325 326 Assert.IsNotNull(target); 326 327 } 328 [TestMethod()] 329 public void NoDuplicateRoleTest() { 330 try { 331 Persistence.HeuristicLabRole role = new Persistence.HeuristicLabRole(); 332 role.RoleName ="role1"; 333 Persistence.HeuristicLabRole role1 = new Persistence.HeuristicLabRole(); 334 role1.RoleName ="role1"; 335 db.HeuristicLabRole.InsertOnSubmit(role); 336 db.HeuristicLabRole.InsertOnSubmit(role1); 337 db.SubmitChanges(); 338 Assert.Fail(); 339 } 340 catch (SqlException) { 341 //swallowing Exception because it is expected that a SQL Exception is thrown 342 } 343 } 327 344 } 328 345 346 347 329 348 330 349
Note: See TracChangeset
for help on using the changeset viewer.