protected override IAddressBookContactsService GetContactsService( InMemoryDataContext dataContext, ref IEnumerable <IAddressBookContact> contacts) { if (contacts != null) { dataContext.Contacts.AddRange(contacts); } contacts = dataContext.Contacts; dataContext.Users.Add( User = new InMemoryUser { Active = true, Email = SecurityTestData.User.Email, PasswordHash = HashService.Hash64(SecurityTestData.User.CorrectPassword) } ); dataContext.Sessions.Add( Session = new InMemorySession { User = User, ExpiresOn = DateTime.UtcNow.AddDays(1) }); return(new AddressBookContactsService( new InMemoryAddressBookContactsDataService(dataContext), new SecurityService( new InMemoryUserDataService(dataContext), new InMemorySessionDataService(dataContext), HashService, new UserRegistrationValidator() ) )); }
public void Setup() { Session = new InMemorySession(); }