Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/25/10 17:42:10 (14 years ago)
Author:
hmayr
Message:

following changes (#1046):

  • changed AbstractHeuristicLabTest.cs
Location:
branches/HeuristicLab.Services.Authentication Prototype/UnitTests
Files:
2 edited

Legend:

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

    r3943 r3949  
    2222
    2323    /// <summary>
    24     /// creates and opens a local database our of the DataClasses
     24    /// creates and opens a local database out of the DataClasses and checks connection state
    2525    /// </summary>
    26     [TestMethod()]
    27     public virtual void createDBTest() {
     26    [TestInitialize()]
     27    public virtual void updateDBConnection() {
    2828      Assert.IsNotNull(db);
    29 
    3029      DatabaseUtil.createDatabase(db);
    31 
     30      if (db.Connection.State != System.Data.ConnectionState.Open) {
     31        db.Connection.Open();
     32      }
    3233      Assert.AreEqual<System.Data.ConnectionState>(System.Data.ConnectionState.Open, db.Connection.State);
    3334    }
    3435
    3536    /// <summary>
    36     /// checks if the database connection is open
    37     /// should be used by all other test methods
     37    /// closes db connection
    3838    /// </summary>
    39     protected virtual void checkConnection() {
    40       Assert.IsNotNull(db);
    41 
    42       if (db.Connection.State != System.Data.ConnectionState.Open) {
    43         db.Connection.Open();
     39    [TestCleanup()]
     40    public virtual void closeDBConnection() {
     41      if (db.Connection.State == System.Data.ConnectionState.Open) {
     42        db.Connection.Close();
    4443      }
    45 
    46       Assert.AreEqual<System.Data.ConnectionState>(System.Data.ConnectionState.Open, db.Connection.State);
     44      Assert.AreEqual<System.Data.ConnectionState>(System.Data.ConnectionState.Closed, db.Connection.State);
    4745    }
    4846  }
  • branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabUserTest.cs

    r3943 r3949  
    1919    [TestMethod()]
    2020    public void modifyUserTest() {
    21       checkConnection();
    22 
    2321      // insert new user
    2422      Persistence.HeuristicLabUser user = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment");
     
    220218      Assert.AreEqual<String>("pwd1", target.GetPassword());
    221219      target.ResetPassword();
    222       Assert.AreEqual<String>("", target.GetPassword());
     220      Assert.AreEqual<String>("INIT", target.GetPassword());
    223221    }
    224222
     
    242240      HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment");
    243241      target.PasswordAnswer = "answer";
    244       Assert.AreEqual<String>("", target.GetPassword("answer"));
     242      Assert.AreEqual<String>("INIT", target.GetPassword("answer"));
    245243      target.ChangePassword(target.Password, "pwd1");
    246244      Assert.AreEqual<String>("pwd1", target.GetPassword("answer"));
Note: See TracChangeset for help on using the changeset viewer.