Changeset 3949


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

following changes (#1046):

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

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/HeuristicLab.Services.Authentication Prototyp.vsmdi

    r3943 r3949  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
    3   <TestList name="HeuristicLabUserTestList" id="1ebca506-0e3e-4cc3-800e-9905f9a66bd2" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    4     <Description>just first test for HeuristicLabUser</Description>
     3  <TestList name="Testlisten" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
     4    <RunConfiguration id="3cde0e70-9e75-4b76-a987-9e1d702958f0" name="Lokaler Testlauf" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common,   PublicKeyToken=b03f5f7f11d50a3a" />
     5  </TestList>
     6  <TestList name="HeuristicLabUserTestList" id="8c8759cd-2720-49fa-8e40-35ae89286ea1" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    57    <TestLinks>
     8      <TestLink id="c94ce8a9-0db1-d5f7-0d29-a5b40ed93b8f" name="ChangePasswordTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
     9      <TestLink id="ecaca427-086c-9493-06af-9887f2d8184f" name="PasswordAnswerTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
     10      <TestLink id="760cee90-ae54-277d-b10b-28dcbd0d3e2b" name="ResetPasswordTest1" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    611      <TestLink id="537e2ce5-1968-64c1-932a-0aff7f0ea564" name="ToStringTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    7       <TestLink id="ecaca427-086c-9493-06af-9887f2d8184f" name="PasswordAnswerTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    8       <TestLink id="c94ce8a9-0db1-d5f7-0d29-a5b40ed93b8f" name="ChangePasswordTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    9       <TestLink id="5c113ee8-ae71-cf76-5bf1-608203739eeb" name="HeuristicLabUserConstructorTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1012      <TestLink id="b6e6a789-8f4e-329c-38ef-d9e19bd14e55" name="PasswordTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    11       <TestLink id="def90666-533d-bda5-8a29-fde7f290333f" name="createDBTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1213      <TestLink id="4452b5de-b1d7-2a87-17cf-5bcef24a98ba" name="modifyUserTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
     14      <TestLink id="e0e05989-bce3-7e2f-d85f-30efe28be806" name="GetPasswordTest1" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1315      <TestLink id="ce8163d5-a5c1-2a43-04b4-3afe6a0140c3" name="ChangePasswordQuestionAndAnswerTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1416      <TestLink id="5a5bdb37-43b0-c6f1-1b5b-7df4fecd3b8f" name="PasswordQuestionTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
     17      <TestLink id="ce5df924-ff5f-962d-94e4-cbd375c40951" name="ResetPasswordTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1518      <TestLink id="799ee04a-e351-af4d-61c5-344e29aaace3" name="UserNameTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1619      <TestLink id="23131c03-ebe9-6d64-7d73-52214a9dac7d" name="EmailTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
     20      <TestLink id="d2c8a683-ac68-bded-8e0e-22e2473daa15" name="GetPasswordTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1721      <TestLink id="e3413b57-3027-8e7d-3f25-67842a5c6986" name="CommentTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1822      <TestLink id="2b5d5229-e68f-6a88-fb76-73fa5d493613" name="LastPasswordChangedDateTest" storage="unittests\bin\debug\unittests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel,   PublicKeyToken=b03f5f7f11d50a3a" />
    1923    </TestLinks>
    2024  </TestList>
    21   <TestList name="Testlisten" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
    22     <RunConfiguration id="3cde0e70-9e75-4b76-a987-9e1d702958f0" name="Lokaler Testlauf" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common,   PublicKeyToken=b03f5f7f11d50a3a" />
    23   </TestList>
    2425</TestLists>
  • 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.