Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/10 21:09:36 (14 years ago)
Author:
bfarka
Message:

added unit tests to check if the unique constraints on rolename username email are working (1046)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs

    r3967 r3974  
    33using System.Linq;
    44using System.Collections.Generic;
     5using System.Data.SqlClient;
    56namespace UnitTests {
    67  /// <summary>
     
    325326      Assert.IsNotNull(target);
    326327    }
     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    }
    327344  }
    328345
     346 
     347
    329348
    330349
Note: See TracChangeset for help on using the changeset viewer.