Changeset 3943 for branches/HeuristicLab.Services.Authentication Prototype
- Timestamp:
- 06/24/10 00:23:16 (14 years ago)
- Location:
- branches/HeuristicLab.Services.Authentication Prototype
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/HeuristicLab.Services.Authentication Prototyp.vsmdi
r3940 r3943 4 4 <Description>just first test for HeuristicLabUser</Description> 5 5 <TestLinks> 6 <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" /> 10 <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" /> 6 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" /> 12 <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" /> 13 <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" /> 14 <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" /> 15 <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" /> 16 <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" /> 17 <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" /> 18 <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" /> 7 19 </TestLinks> 8 20 </TestList> -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/DataClasses.dbml
r3942 r3943 4 4 <Type Name="HeuristicLabUser"> 5 5 <Column Name="id" Member="ID" Storage="_id" Type="System.Int64" IsReadOnly="true" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 6 <Column Name="UserName" Modifier=" Override" Type="System.String" IsReadOnly="true" CanBeNull="false" />6 <Column Name="UserName" Modifier="Virtual" Type="System.String" IsReadOnly="true" CanBeNull="false" /> 7 7 <Column Name="Password" Type="System.String" CanBeNull="false" /> 8 <Column Name="LastPasswordChangedDate" Modifier=" Override" Type="System.DateTime" IsReadOnly="true" CanBeNull="false" />9 <Column Name="PasswordQuestion" Modifier=" Override" Type="System.String" IsReadOnly="true" CanBeNull="false" />8 <Column Name="LastPasswordChangedDate" Modifier="Virtual" Type="System.DateTime" IsReadOnly="true" CanBeNull="false" /> 9 <Column Name="PasswordQuestion" Modifier="Virtual" Type="System.String" IsReadOnly="true" CanBeNull="false" /> 10 10 <Column Name="PasswordAnswer" Type="System.String" CanBeNull="false" /> 11 <Column Name="Email" Modifier=" Override" Type="System.String" CanBeNull="false" />12 <Column Name="Comment" Modifier=" Override" Type="System.String" CanBeNull="false" />11 <Column Name="Email" Modifier="Virtual" Type="System.String" CanBeNull="false" /> 12 <Column Name="Comment" Modifier="Virtual" Type="System.String" CanBeNull="false" /> 13 13 <Association Name="HeuristicLabUser_HeuristicLabUserRole" Member="HeuristicLabUserRole" ThisKey="ID" OtherKey="HeuristicLabUserID" Type="HeuristicLabUserRole" /> 14 14 </Type> 15 15 </Table> 16 16 <Table Name="" Member="HeuristicLabAbstractRoles"> 17 <Type Name="HeuristicLabAbstractRole" IsInheritanceDefault="true"Modifier="Abstract">17 <Type Name="HeuristicLabAbstractRole" Modifier="Abstract"> 18 18 <Column Name="ID" Type="System.Int64" IsReadOnly="true" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 19 19 <Column Name="roleName" Member="RoleName" Storage="_roleName" Type="System.String" CanBeNull="false" /> 20 20 <Column Name="parentRoleID" Member="ParentRoleID" Storage="_parentRoleID" Type="System.Int64" CanBeNull="false" /> 21 <Column Member="RoleType" Type="System.String" IsReadOnly="true" CanBeNull="false" UpdateCheck="Always" IsDiscriminator="true" /> 21 <Column Name="RoleType" Type="System.String" IsReadOnly="true" CanBeNull="false" IsDiscriminator="true" /> 22 <Association Name="HeuristicLabAbstractRole_HeuristicLabAbstractRole" Member="HeuristicLabAbstractRole2" ThisKey="ID" OtherKey="ParentRoleID" Type="HeuristicLabAbstractRole" /> 22 23 <Association Name="HeuristicLabAbstractRole_HeuristicLabUserRole" Member="HeuristicLabUserRole" ThisKey="ID" OtherKey="HeuristicLabRoleID" Type="HeuristicLabUserRole" /> 23 <Association Name="HeuristicLabAbstractRole_HeuristicLabAbstractRole" Member="HeuristicLabAbstractRole2" ThisKey="ID" OtherKey="ParentRoleID" Type="HeuristicLabAbstractRole" />24 24 <Association Name="HeuristicLabAbstractRole_HeuristicLabAbstractRole" Member="HeuristicLabAbstractRole1" ThisKey="ParentRoleID" OtherKey="ID" Type="HeuristicLabAbstractRole" IsForeignKey="true" /> 25 25 <Type Name="HeuristicLabPermissionRole" InheritanceCode="permission" /> 26 <Type Name="HeuristicLabRole" InheritanceCode="role" />26 <Type Name="HeuristicLabRole" InheritanceCode="role" IsInheritanceDefault="true" /> 27 27 </Type> 28 28 </Table> 29 29 <Table Name="" Member="HeuristicLabUserRole"> 30 30 <Type Name="HeuristicLabUserRole"> 31 <Column Member="ID" Type="System.Int64" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />32 <Column Member="HeuristicLabUserID" Type="System.Int64" CanBeNull="false" />33 <Column Member="HeuristicLabRoleID" Type="System.Int64" CanBeNull="false" />31 <Column Name="ID" Type="System.Int64" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 32 <Column Name="HeuristicLabUserID" Type="System.Int64" CanBeNull="false" /> 33 <Column Name="HeuristicLabRoleID" Type="System.Int64" CanBeNull="false" /> 34 34 <Association Name="HeuristicLabUser_HeuristicLabUserRole" Member="HeuristicLabUser" ThisKey="HeuristicLabUserID" OtherKey="ID" Type="HeuristicLabUser" IsForeignKey="true" /> 35 35 <Association Name="HeuristicLabAbstractRole_HeuristicLabUserRole" Member="HeuristicLabAbstractRole" ThisKey="HeuristicLabRoleID" OtherKey="ID" Type="HeuristicLabAbstractRole" IsForeignKey="true" /> -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/DataClasses.dbml.layout
r3942 r3943 27 27 </nestedChildShapes> 28 28 </classShape> 29 <inheritanceConnector edgePoints="[(5.5 : 2.22679768880208); (6.875 : 2.22679768880208)]" fixedFrom=" Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">29 <inheritanceConnector edgePoints="[(5.5 : 2.22679768880208); (6.875 : 2.22679768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62"> 30 30 <nodes> 31 31 <classShapeMoniker Id="c7373ccc-61b3-43fb-88fa-14149d69bee9" /> … … 33 33 </nodes> 34 34 </inheritanceConnector> 35 <inheritanceConnector edgePoints="[(5.5 : 1.21719482421875); (6.875 : 1.21719482421875)]" fixedFrom=" Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">35 <inheritanceConnector edgePoints="[(5.5 : 1.21719482421875); (6.875 : 1.21719482421875)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62"> 36 36 <nodes> 37 37 <classShapeMoniker Id="c7373ccc-61b3-43fb-88fa-14149d69bee9" /> … … 45 45 </nestedChildShapes> 46 46 </classShape> 47 <associationConnector edgePoints="[(1.5625 : 2.97280110677083); (1.5625 : 3.625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">47 <associationConnector edgePoints="[(1.5625 : 2.97280110677083); (1.5625 : 3.625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 48 48 <AssociationMoniker Name="/DataClassesDataContext/HeuristicLabUser/HeuristicLabUser_HeuristicLabUserRole" /> 49 49 <nodes> … … 52 52 </nodes> 53 53 </associationConnector> 54 <associationConnector edgePoints="[(3.9687475 : 2.45359537760417); (3.9687475 : 4.35564697265625); (2.625 : 4.35564697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">54 <associationConnector edgePoints="[(3.9687475 : 2.45359537760417); (3.9687475 : 4.35564697265625); (2.625 : 4.35564697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 55 55 <AssociationMoniker Name="/DataClassesDataContext/HeuristicLabAbstractRole/HeuristicLabAbstractRole_HeuristicLabUserRole" /> 56 56 <nodes> -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/DataClasses.designer.cs
r3942 r3943 2 2 //------------------------------------------------------------------------------ 3 3 // <auto-generated> 4 // Dieser Code wurde von einem Tool generiert.5 // Laufzeitversion:2.0.50727.49274 // This code was generated by a tool. 5 // Runtime Version:2.0.50727.4927 6 6 // 7 // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn8 // der Code erneut generiert wird.7 // Changes to this file may cause incorrect behavior and will be lost if 8 // the code is regenerated. 9 9 // </auto-generated> 10 10 //------------------------------------------------------------------------------ … … 144 144 145 145 [Column(Storage="_UserName", CanBeNull=false, UpdateCheck=UpdateCheck.Never)] 146 public overridestring UserName146 public virtual string UserName 147 147 { 148 148 get … … 173 173 174 174 [Column(Storage="_LastPasswordChangedDate", UpdateCheck=UpdateCheck.Never)] 175 public overrideSystem.DateTime LastPasswordChangedDate175 public virtual System.DateTime LastPasswordChangedDate 176 176 { 177 177 get … … 182 182 183 183 [Column(Storage="_PasswordQuestion", CanBeNull=false, UpdateCheck=UpdateCheck.Never)] 184 public overridestring PasswordQuestion184 public virtual string PasswordQuestion 185 185 { 186 186 get … … 211 211 212 212 [Column(Storage="_Email", CanBeNull=false)] 213 public overridestring Email213 public virtual string Email 214 214 { 215 215 get … … 231 231 232 232 [Column(Storage="_Comment", CanBeNull=false)] 233 public overridestring Comment233 public virtual string Comment 234 234 { 235 235 get … … 298 298 [Table(Name="")] 299 299 [InheritanceMapping(Code="permission", Type=typeof(HeuristicLabPermissionRole))] 300 [InheritanceMapping(Code="role", Type=typeof(HeuristicLabRole) )]300 [InheritanceMapping(Code="role", Type=typeof(HeuristicLabRole), IsDefault=true)] 301 301 public abstract partial class HeuristicLabAbstractRole : INotifyPropertyChanging, INotifyPropertyChanged 302 302 { … … 312 312 private string _RoleType = default(string); 313 313 314 private EntitySet<HeuristicLabAbstractRole> _HeuristicLabAbstractRole2; 315 314 316 private EntitySet<HeuristicLabUserRole> _HeuristicLabUserRole; 315 316 private EntitySet<HeuristicLabAbstractRole> _HeuristicLabAbstractRole2;317 317 318 318 private EntityRef<HeuristicLabAbstractRole> _HeuristicLabAbstractRole1; … … 330 330 public HeuristicLabAbstractRole() 331 331 { 332 this._HeuristicLabAbstractRole2 = new EntitySet<HeuristicLabAbstractRole>(new Action<HeuristicLabAbstractRole>(this.attach_HeuristicLabAbstractRole2), new Action<HeuristicLabAbstractRole>(this.detach_HeuristicLabAbstractRole2)); 332 333 this._HeuristicLabUserRole = new EntitySet<HeuristicLabUserRole>(new Action<HeuristicLabUserRole>(this.attach_HeuristicLabUserRole), new Action<HeuristicLabUserRole>(this.detach_HeuristicLabUserRole)); 333 this._HeuristicLabAbstractRole2 = new EntitySet<HeuristicLabAbstractRole>(new Action<HeuristicLabAbstractRole>(this.attach_HeuristicLabAbstractRole2), new Action<HeuristicLabAbstractRole>(this.detach_HeuristicLabAbstractRole2));334 334 this._HeuristicLabAbstractRole1 = default(EntityRef<HeuristicLabAbstractRole>); 335 335 OnCreated(); … … 394 394 } 395 395 396 [Association(Name="HeuristicLabAbstractRole_HeuristicLabAbstractRole", Storage="_HeuristicLabAbstractRole2", ThisKey="ID", OtherKey="ParentRoleID")] 397 public EntitySet<HeuristicLabAbstractRole> HeuristicLabAbstractRole2 398 { 399 get 400 { 401 return this._HeuristicLabAbstractRole2; 402 } 403 set 404 { 405 this._HeuristicLabAbstractRole2.Assign(value); 406 } 407 } 408 396 409 [Association(Name="HeuristicLabAbstractRole_HeuristicLabUserRole", Storage="_HeuristicLabUserRole", ThisKey="ID", OtherKey="HeuristicLabRoleID")] 397 410 public EntitySet<HeuristicLabUserRole> HeuristicLabUserRole … … 404 417 { 405 418 this._HeuristicLabUserRole.Assign(value); 406 }407 }408 409 [Association(Name="HeuristicLabAbstractRole_HeuristicLabAbstractRole", Storage="_HeuristicLabAbstractRole2", ThisKey="ID", OtherKey="ParentRoleID")]410 public EntitySet<HeuristicLabAbstractRole> HeuristicLabAbstractRole2411 {412 get413 {414 return this._HeuristicLabAbstractRole2;415 }416 set417 {418 this._HeuristicLabAbstractRole2.Assign(value);419 419 } 420 420 } … … 474 474 } 475 475 476 private void attach_HeuristicLabAbstractRole2(HeuristicLabAbstractRole entity) 477 { 478 this.SendPropertyChanging(); 479 entity.HeuristicLabAbstractRole1 = this; 480 } 481 482 private void detach_HeuristicLabAbstractRole2(HeuristicLabAbstractRole entity) 483 { 484 this.SendPropertyChanging(); 485 entity.HeuristicLabAbstractRole1 = null; 486 } 487 476 488 private void attach_HeuristicLabUserRole(HeuristicLabUserRole entity) 477 489 { … … 484 496 this.SendPropertyChanging(); 485 497 entity.HeuristicLabAbstractRole = null; 486 }487 488 private void attach_HeuristicLabAbstractRole2(HeuristicLabAbstractRole entity)489 {490 this.SendPropertyChanging();491 entity.HeuristicLabAbstractRole1 = this;492 }493 494 private void detach_HeuristicLabAbstractRole2(HeuristicLabAbstractRole entity)495 {496 this.SendPropertyChanging();497 entity.HeuristicLabAbstractRole1 = null;498 498 } 499 499 } -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/DatabaseUtil.cs
r3940 r3943 1 namespace Persistence { 1 using System; 2 3 namespace Persistence { 2 4 /// <summary> 3 /// 5 /// combines multiple used static methods into one class 4 6 /// </summary> 5 7 public class DatabaseUtil { 6 8 /// <summary> 7 /// 9 /// creates and returns a database connection, if possible 8 10 /// </summary> 9 /// <returns> </returns>11 /// <returns>database connection (could be null)</returns> 10 12 public static DataClassesDataContext createDataClassesDataContext() { 11 return new Persistence.DataClassesDataContext(@"C:\TEMP\HeuristicLabTemp.mdf"); 13 DataClassesDataContext db; 14 try { 15 db = new Persistence.DataClassesDataContext(@"C:\TEMP\HeuristicLabTemp.mdf"); 16 } 17 catch (Exception) { 18 return null; 19 } 20 return db; 21 } 22 23 /// <summary> 24 /// creates a new database out of the LINQ to SQL classes 25 /// </summary> 26 /// <param name="db">DataClassesDataContext</param> 27 public static void createDatabase(DataClassesDataContext db) { 28 if (db == null) { 29 throw new ArgumentNullException("db"); 30 } 31 32 if (db.DatabaseExists()) { 33 Console.WriteLine("Deleting old database..."); 34 db.DeleteDatabase(); 35 Console.WriteLine("Deleted old database!"); 36 } 37 38 Console.WriteLine("Creating new database..."); 39 db.CreateDatabase(); 40 Console.WriteLine("Created new database!"); 12 41 } 13 42 } -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUser.cs
r3941 r3943 3 3 4 4 namespace Persistence { 5 /// <summary> 6 /// implements the MembershipUser for HeuristicLab 7 /// </summary> 5 8 partial class HeuristicLabUser : MembershipUser { 9 public HeuristicLabUser(string name, string email, string passwordQuestion, string comment) : this() { 10 _UserName = name; 11 Password = "INIT"; // just for tests 12 _LastPasswordChangedDate = System.DateTime.Today; 13 _PasswordQuestion = passwordQuestion; 14 PasswordAnswer = ""; 15 Email = email; 16 Comment = comment; 17 } 18 6 19 public override bool ChangePassword(string oldPassword, string newPassword) { 7 20 if (oldPassword == null) { -
branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabMembershipProvider.cs
r3939 r3943 1 1 using System; 2 using System.Collections.Generic;3 2 using System.Linq; 4 using System.Text;5 3 using System.Web.Security; 4 using Persistence; 6 5 7 6 namespace Service.Provider { … … 17 16 18 17 public override bool ChangePassword(string username, string oldPassword, string newPassword) { 19 throw new NotImplementedException(); 18 DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext(); 19 if (db == null) { 20 return false; 21 } 22 try { 23 HeuristicLabUser u = db.HeuristicLabUsers.Single(x => x.UserName == username); 24 if (u.ChangePassword(oldPassword, newPassword)) { 25 db.SubmitChanges(); 26 return true; 27 } else { 28 return false; 29 } 30 } 31 catch (Exception) { 32 return false; 33 } 20 34 } 21 35 -
branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs
r3939 r3943 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;5 2 using System.Web.Security; 3 using Persistence; 6 4 7 5 namespace Service.Provider { -
branches/HeuristicLab.Services.Authentication Prototype/Service/Service.csproj
r3932 r3943 38 38 </Reference> 39 39 <Reference Include="System.Data" /> 40 <Reference Include="System.Data.Linq"> 41 <RequiredTargetFramework>3.5</RequiredTargetFramework> 42 </Reference> 40 43 <Reference Include="System.Runtime.Serialization"> 41 44 <RequiredTargetFramework>3.0</RequiredTargetFramework> … … 74 77 </Target> 75 78 --> 79 <ProjectExtensions> 80 <VisualStudio> 81 <FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}"> 82 <WcfProjectProperties> 83 <AutoStart>True</AutoStart> 84 </WcfProjectProperties> 85 </FlavorProperties> 86 </VisualStudio> 87 </ProjectExtensions> 76 88 </Project> -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabMembershipProviderTest.cs
r3939 r3943 4 4 5 5 namespace UnitTests { 6 7 8 6 /// <summary> 9 7 ///Dies ist eine Testklasse für "HeuristicLabMembershipProviderTest" und soll … … 11 9 ///</summary> 12 10 [TestClass()] 13 public class HeuristicLabMembershipProviderTest { 14 15 11 public class HeuristicLabMembershipProviderTest : AbstractHeuristicLabTest { 16 12 private TestContext testContextInstance; 17 13 … … 59 55 #endregion 60 56 61 62 57 /// <summary> 63 58 ///Ein Test für "RequiresUniqueEmail" -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs
r3939 r3943 2 2 using Microsoft.VisualStudio.TestTools.UnitTesting; 3 3 namespace UnitTests { 4 5 6 4 /// <summary> 7 5 ///Dies ist eine Testklasse für "HeuristicLabRoleProviderTest" und soll … … 9 7 ///</summary> 10 8 [TestClass()] 11 public class HeuristicLabRoleProviderTest { 12 13 9 public class HeuristicLabRoleProviderTest : AbstractHeuristicLabTest { 14 10 private TestContext testContextInstance; 15 11 … … 57 53 #endregion 58 54 59 60 55 /// <summary> 61 56 ///Ein Test für "ApplicationName" -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabUserTest.cs
r3940 r3943 1 using Persistence; 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 2 4 using Microsoft.VisualStudio.TestTools.UnitTesting; 3 using System;5 using Persistence; 4 6 5 7 namespace UnitTests { … … 9 11 ///</summary> 10 12 [TestClass()] 11 public class HeuristicLabUserTest {13 public class HeuristicLabUserTest : AbstractHeuristicLabTest { 12 14 private TestContext testContextInstance; 13 15 14 private Persistence.DataClassesDataContext db; 15 16 public HeuristicLabUserTest() { 17 db = Persistence.DatabaseUtil.createDataClassesDataContext(); 18 } 19 20 /// <summary> 21 /// creates a local database for all other test methods 16 /// <summary> 17 /// inserts, modifies and deletes a new user into the database 22 18 /// </summary> 23 19 [TestMethod()] 24 public void createDBTest() { 25 if (db.DatabaseExists()) { 26 Console.WriteLine("Deleting old database..."); 27 db.DeleteDatabase(); 28 Console.WriteLine("Deleted old database!"); 29 } 30 Console.WriteLine("Creating new database..."); 31 db.CreateDatabase(); 32 Console.WriteLine("Created new database!"); 33 } 34 35 /// <summary> 36 /// inserts a new user into the database 37 /// </summary> 38 [TestMethod()] 39 public void addUserTest() { 40 //Assert.IsNotNull(db); 41 42 //Persistence.HeuristicLabUser user = new HeuristicLabUser(); 43 //user.UserName = "TEST"; 44 //db.HeuristicLabUsers.InsertOnSubmit(user); 45 //db.SubmitChanges(); 46 47 // db.HeuristicLabUsers. 20 public void modifyUserTest() { 21 checkConnection(); 22 23 // insert new user 24 Persistence.HeuristicLabUser user = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 25 db.HeuristicLabUsers.InsertOnSubmit(user); 26 db.SubmitChanges(); 27 Persistence.HeuristicLabUser u = db.HeuristicLabUsers.Single(x => x.UserName == "testname"); 28 Assert.IsNotNull(u); 29 Assert.AreEqual<string>("testname", u.UserName); 30 Assert.AreEqual<string>("testemail", u.Email); 31 Assert.AreEqual<string>("testquestion", u.PasswordQuestion); 32 Assert.AreEqual<string>("testcomment", u.Comment); 33 34 // modify existing user 35 u.Email = "testemail2"; 36 u.Comment = "testcomment2"; 37 db.SubmitChanges(); 38 u = db.HeuristicLabUsers.Single(x => x.UserName == "testname"); 39 Assert.IsNotNull(u); 40 Assert.AreEqual<string>("testname", u.UserName); 41 Assert.AreEqual<string>("testemail2", u.Email); 42 Assert.AreEqual<string>("testquestion", u.PasswordQuestion); 43 Assert.AreEqual<string>("testcomment2", u.Comment); 44 45 // delete user 46 db.HeuristicLabUsers.DeleteOnSubmit(u); 47 db.SubmitChanges(); 48 List<HeuristicLabUser> uList = db.HeuristicLabUsers.Where(x => x.UserName == "testname").ToList<HeuristicLabUser>(); 49 Assert.AreEqual(0, uList.Count); 48 50 } 49 51 … … 91 93 #endregion 92 94 93 94 95 /// <summary> 95 96 ///A test for UserName … … 97 98 [TestMethod()] 98 99 public void UserNameTest() { 99 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 100 string actual; 101 actual = target.UserName; 100 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 101 Assert.AreEqual<String>("testname", target.UserName); 102 } 103 104 /// <summary> 105 ///A test for PasswordQuestion 106 ///</summary> 107 [TestMethod()] 108 public void PasswordQuestionTest() { 109 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 110 Assert.AreEqual<String>("testquestion", target.PasswordQuestion); 111 target.ChangePasswordQuestionAndAnswer("INIT", "newquestion", "newanswer"); 112 Assert.AreEqual<String>("newquestion", target.PasswordQuestion); 113 } 114 115 /// <summary> 116 ///A test for PasswordAnswer 117 ///</summary> 118 [TestMethod()] 119 public void PasswordAnswerTest() { 120 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 121 Assert.AreEqual<String>("", target.PasswordAnswer); 122 target.ChangePasswordQuestionAndAnswer("INIT", "newquestion", "newanswer"); 123 Assert.AreEqual<String>("newquestion", target.PasswordQuestion); 124 target.PasswordAnswer = "testanswer"; 125 Assert.AreEqual<String>("testanswer", target.PasswordAnswer); 126 } 127 128 /// <summary> 129 ///A test for Password 130 ///</summary> 131 [TestMethod()] 132 public void PasswordTest() { 133 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 134 Assert.AreEqual<String>("INIT", target.Password); 135 target.ChangePassword(target.Password, "pwd1"); 136 Assert.AreEqual<String>("pwd1", target.Password); 137 target.ChangePassword("pwd1", "pwd2"); 138 Assert.AreEqual<String>("pwd2", target.Password); 139 } 140 141 /// <summary> 142 ///A test for LastPasswordChangedDate 143 ///</summary> 144 [TestMethod()] 145 public void LastPasswordChangedDateTest() { 146 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 147 Assert.AreEqual<DateTime>(System.DateTime.Today, target.LastPasswordChangedDate); 148 target.ChangePassword(target.Password, "pwd1"); 149 Assert.AreEqual<DateTime>(System.DateTime.Today, target.LastPasswordChangedDate); 150 } 151 152 /// <summary> 153 ///A test for Email 154 ///</summary> 155 [TestMethod()] 156 public void EmailTest() { 157 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 158 Assert.AreEqual<String>("testemail", target.Email); 159 target.Email = "testemail2"; 160 Assert.AreEqual<String>("testemail2", target.Email); 161 } 162 163 /// <summary> 164 ///A test for Comment 165 ///</summary> 166 [TestMethod()] 167 public void CommentTest() { 168 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 169 target.Comment = "testcomment2"; 170 Assert.AreEqual<String>("testcomment2", target.Comment); 171 } 172 173 /// <summary> 174 ///A test for UnlockUser 175 ///</summary> 176 [TestMethod()] 177 public void UnlockUserTest() { 102 178 Assert.Inconclusive("Verify the correctness of this test method."); 103 179 } 104 180 105 181 /// <summary> 106 ///A test for PasswordQuestion107 ///</summary>108 [TestMethod()]109 public void PasswordQuestionTest() {110 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value111 string actual;112 actual = target.PasswordQuestion;113 Assert.Inconclusive("Verify the correctness of this test method.");114 }115 116 /// <summary>117 ///A test for PasswordAnswer118 ///</summary>119 [TestMethod()]120 public void PasswordAnswerTest() {121 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value122 string expected = string.Empty; // TODO: Initialize to an appropriate value123 string actual;124 target.PasswordAnswer = expected;125 actual = target.PasswordAnswer;126 Assert.AreEqual(expected, actual);127 Assert.Inconclusive("Verify the correctness of this test method.");128 }129 130 /// <summary>131 ///A test for Password132 ///</summary>133 [TestMethod()]134 public void PasswordTest() {135 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value136 string expected = string.Empty; // TODO: Initialize to an appropriate value137 string actual;138 target.Password = expected;139 actual = target.Password;140 Assert.AreEqual(expected, actual);141 Assert.Inconclusive("Verify the correctness of this test method.");142 }143 144 /// <summary>145 ///A test for LastPasswordChangedDate146 ///</summary>147 [TestMethod()]148 public void LastPasswordChangedDateTest() {149 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value150 DateTime actual;151 actual = target.LastPasswordChangedDate;152 Assert.Inconclusive("Verify the correctness of this test method.");153 }154 155 /// <summary>156 ///A test for Email157 ///</summary>158 [TestMethod()]159 public void EmailTest() {160 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value161 string expected = string.Empty; // TODO: Initialize to an appropriate value162 string actual;163 target.Email = expected;164 actual = target.Email;165 Assert.AreEqual(expected, actual);166 Assert.Inconclusive("Verify the correctness of this test method.");167 }168 169 /// <summary>170 ///A test for Comment171 ///</summary>172 [TestMethod()]173 public void CommentTest() {174 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value175 string expected = string.Empty; // TODO: Initialize to an appropriate value176 string actual;177 target.Comment = expected;178 actual = target.Comment;179 Assert.AreEqual(expected, actual);180 Assert.Inconclusive("Verify the correctness of this test method.");181 }182 183 /// <summary>184 ///A test for UnlockUser185 ///</summary>186 [TestMethod()]187 public void UnlockUserTest() {188 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value189 bool expected = false; // TODO: Initialize to an appropriate value190 bool actual;191 actual = target.UnlockUser();192 Assert.AreEqual(expected, actual);193 Assert.Inconclusive("Verify the correctness of this test method.");194 }195 196 /// <summary>197 182 ///A test for ToString 198 183 ///</summary> 199 184 [TestMethod()] 200 185 public void ToStringTest() { 201 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 202 string expected = string.Empty; // TODO: Initialize to an appropriate value 203 string actual; 204 actual = target.ToString(); 205 Assert.AreEqual(expected, actual); 206 Assert.Inconclusive("Verify the correctness of this test method."); 186 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 187 Assert.AreEqual<String>("testname", target.ToString()); 207 188 } 208 189 … … 235 216 [TestMethod()] 236 217 public void ResetPasswordTest1() { 237 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 238 string expected = string.Empty; // TODO: Initialize to an appropriate value 239 string actual; 240 actual = target.ResetPassword(); 241 Assert.AreEqual(expected, actual); 242 Assert.Inconclusive("Verify the correctness of this test method."); 218 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 219 target.ChangePassword(target.Password, "pwd1"); 220 Assert.AreEqual<String>("pwd1", target.GetPassword()); 221 target.ResetPassword(); 222 Assert.AreEqual<String>("", target.GetPassword()); 243 223 } 244 224 … … 248 228 [TestMethod()] 249 229 public void ResetPasswordTest() { 250 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 251 string passwordAnswer = string.Empty; // TODO: Initialize to an appropriate value 252 string expected = string.Empty; // TODO: Initialize to an appropriate value 253 string actual; 254 actual = target.ResetPassword(passwordAnswer); 255 Assert.AreEqual(expected, actual); 256 Assert.Inconclusive("Verify the correctness of this test method."); 230 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 231 target.ChangePassword(target.Password, "pwd1"); 232 Assert.AreEqual<String>("pwd1", target.GetPassword()); 233 target.ResetPassword("wrongAnswer"); 234 Assert.AreEqual<String>("pwd1", target.GetPassword()); 257 235 } 258 236 … … 262 240 [TestMethod()] 263 241 public void GetPasswordTest1() { 264 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 265 string passwordAnswer = string.Empty; // TODO: Initialize to an appropriate value 266 string expected = string.Empty; // TODO: Initialize to an appropriate value 267 string actual; 268 actual = target.GetPassword(passwordAnswer); 269 Assert.AreEqual(expected, actual); 270 Assert.Inconclusive("Verify the correctness of this test method."); 242 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 243 target.PasswordAnswer = "answer"; 244 Assert.AreEqual<String>("", target.GetPassword("answer")); 245 target.ChangePassword(target.Password, "pwd1"); 246 Assert.AreEqual<String>("pwd1", target.GetPassword("answer")); 247 target.ChangePassword("pwd1", "pwd2"); 248 Assert.AreEqual<String>("pwd2", target.GetPassword("answer")); 249 Assert.AreEqual<String>("", target.GetPassword("wrong")); 271 250 } 272 251 … … 276 255 [TestMethod()] 277 256 public void GetPasswordTest() { 278 HeuristicLabUser target = new HeuristicLabUser( ); // TODO: Initialize to an appropriate value279 string expected = string.Empty; // TODO: Initialize to an appropriate value280 string actual;281 actual = target.GetPassword();282 Assert.AreEqual(expected, actual);283 Assert. Inconclusive("Verify the correctness of this test method.");257 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 258 Assert.AreEqual<String>("INIT", target.GetPassword()); 259 target.ChangePassword(target.Password, "pwd1"); 260 Assert.AreEqual<String>("pwd1", target.GetPassword()); 261 target.ChangePassword("pwd1", "pwd2"); 262 Assert.AreEqual<String>("pwd2", target.GetPassword()); 284 263 } 285 264 … … 289 268 [TestMethod()] 290 269 public void ChangePasswordQuestionAndAnswerTest() { 291 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 292 string password = string.Empty; // TODO: Initialize to an appropriate value 293 string newPasswordQuestion = string.Empty; // TODO: Initialize to an appropriate value 294 string newPasswordAnswer = string.Empty; // TODO: Initialize to an appropriate value 295 bool expected = false; // TODO: Initialize to an appropriate value 296 bool actual; 297 actual = target.ChangePasswordQuestionAndAnswer(password, newPasswordQuestion, newPasswordAnswer); 298 Assert.AreEqual(expected, actual); 299 Assert.Inconclusive("Verify the correctness of this test method."); 270 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 271 Assert.AreEqual<String>("testquestion", target.PasswordQuestion); 272 Assert.AreEqual<String>("", target.PasswordAnswer); 273 target.ChangePasswordQuestionAndAnswer("INIT", "newquestion", "newanswer"); 274 Assert.AreEqual<String>("newquestion", target.PasswordQuestion); 275 Assert.AreEqual<String>("newanswer", target.PasswordAnswer); 300 276 } 301 277 … … 305 281 [TestMethod()] 306 282 public void ChangePasswordTest() { 307 HeuristicLabUser target = new HeuristicLabUser(); // TODO: Initialize to an appropriate value 308 string oldPassword = string.Empty; // TODO: Initialize to an appropriate value 309 string newPassword = string.Empty; // TODO: Initialize to an appropriate value 310 bool expected = false; // TODO: Initialize to an appropriate value 311 bool actual; 312 actual = target.ChangePassword(oldPassword, newPassword); 313 Assert.AreEqual(expected, actual); 314 Assert.Inconclusive("Verify the correctness of this test method."); 283 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 284 Assert.AreEqual<String>("INIT", target.Password); 285 target.ChangePassword(target.Password, "pwd1"); 286 Assert.AreEqual<String>("pwd1", target.Password); 287 target.ChangePassword("pwd1", "pwd2"); 288 Assert.AreEqual<String>("pwd2", target.Password); 289 try { 290 target.ChangePassword("abc", "def"); 291 Assert.Fail(); 292 } 293 catch (Exception) { 294 } 315 295 } 316 296 … … 320 300 [TestMethod()] 321 301 public void HeuristicLabUserConstructorTest() { 322 HeuristicLabUser target = new HeuristicLabUser(); 323 Assert.Inconclusive("TODO: Implement code to verify target"); 302 HeuristicLabUser target = new HeuristicLabUser("testname", "testemail", "testquestion", "testcomment"); 303 Assert.AreEqual<String>("testname", target.UserName); 304 Assert.AreEqual<String>("INIT", target.Password); 305 Assert.AreEqual<DateTime>(System.DateTime.Today, target.LastPasswordChangedDate); 306 Assert.AreEqual<String>("testquestion", target.PasswordQuestion); 307 Assert.AreEqual<String>("", target.PasswordAnswer); 308 Assert.AreEqual<String>("testemail", target.Email); 309 Assert.AreEqual<String>("testcomment", target.Comment); 324 310 } 325 311 } -
branches/HeuristicLab.Services.Authentication Prototype/UnitTests/UnitTests.csproj
r3940 r3943 58 58 </ItemGroup> 59 59 <ItemGroup> 60 <Compile Include="AbstractHeuristicLabTest.cs" /> 60 61 <Compile Include="HeuristicLabMembershipProviderTest.cs" /> 61 62 <Compile Include="HeuristicLabRoleProviderTest.cs" />
Note: See TracChangeset
for help on using the changeset viewer.