public void Should_send_forgotten_password_email_when_email_address_exists() { MailMessage forgottenPasswordEmail = new MailMessage(); MockRepository mocks = new MockRepository(); ISystemUser user = mocks.CreateMock <ISystemUser>(); IForgottenPasswordMailFactory mailFactory = mocks.CreateMock <IForgottenPasswordMailFactory>(); ISystemUserRepository repository = mocks.CreateMock <ISystemUserRepository>(); IEncryptionEngine encryptionEngine = mocks.CreateMock <IEncryptionEngine>(); IMailSender sender = mocks.CreateMock <IMailSender>(); using (mocks.Record()) { Expect.Call(repository.GetByEmailAddress("*****@*****.**")).Return(user); Expect.Call(user.Password).Return("encryptedPassword"); Expect.Call(encryptionEngine.Decrypt("encryptedPassword")).Return("clearTextPassword"); Expect.Call(mailFactory.CreateEmail("*****@*****.**", "clearTextPassword")).Return(forgottenPasswordEmail); sender.SendMail(forgottenPasswordEmail); } using (mocks.Playback()) { IForgottenPasswordMailer mailer = new ForgottenPasswordMailer(encryptionEngine, mailFactory, sender); bool emailWasSent = mailer.SendForgottenPasswordEmail("*****@*****.**", repository); Assert.That(emailWasSent); } mocks.VerifyAll(); }
public AccountController( IEncryptionEngine encryptionEngine, ISmtpEmail smtpEmail, IProductRepository productRepository) { _encryptionEngine = encryptionEngine; _smtpEmail = smtpEmail; _productRepository = productRepository; }
public PWDatabaseDataSource(IEncryptionEngine encryptionEngine, IKeyTransformer keyTransformer, IGZipStreamFactory gzipStreamFactory, ICanSHA256Hash hasher) { _hasher = hasher; _gzipStreamFactory = gzipStreamFactory; _keyTransformer = keyTransformer; _encryptionEngine = encryptionEngine; }
public KdbWriterFactory(IEncryptionEngine databaseEncryptor, IKeyTransformer keyTransformer, ICanSHA256Hash hasher, IGZipStreamFactory gzipFactory) { _gzipFactory = gzipFactory; _hasher = hasher; _keyTransformer = keyTransformer; _databaseEncryptor = databaseEncryptor; }
public AccountController( IEncryptionEngine encryptionEngine, ISmtpEmail smtpEmail, IProductRepository productRepository, IAccountRepository accountRepository) { _encryptionEngine = encryptionEngine; _smtpEmail = smtpEmail; _productRepository = productRepository; _accountRepository = accountRepository; }
public Kdb4Reader(Kdb4File kdb4File, IEncryptionEngine databaseDecryptor, IKeyTransformer keyTransformer, ICanSHA256Hash hasher, IGZipStreamFactory gZipFactory) { file = kdb4File; _encryptionEngine = databaseDecryptor; _keyTransformer = keyTransformer; _hasher = hasher; _gZipFactory = gZipFactory; }
public Kdb4Writer(Kdb4HeaderWriter headerWriter, IEncryptionEngine databaseEncryptor, IKeyTransformer keyTransformer, ICanSHA256Hash hasher, IGZipStreamFactory gZipFactory) { this._gZipFactory = gZipFactory; this._hasher = hasher; this._keyTransformer = keyTransformer; this._databaseEncryptor = databaseEncryptor; _headerWriter = headerWriter; }
private static IEncryptionEngine GetEncryptionEngine(EncryptionMethod encryptionMethod) { IEncryptionEngine engine = null; switch (encryptionMethod) { case EncryptionMethod.TripleDES: engine = new Encryption.TripleDESEncryptionEngine(); break; } return(engine); }
public void InitializeManager() { Settings = ((App)Application.Current).Settings; Driver = new DriverConnector(); Driver.InitializeDevice(); InterfaceConfig = new NetworkInterfaceConfiguation(); //Encryption = new PlainTextEngine(); Encryption = new AesEngineBC(); Encryption.Initialize(); KeyExchange = new KeyExchangeEngine(); KeyExchange.InitializeKey(); HeartbeatTimer = new System.Timers.Timer(TimeBetweenHeartbeats); HeartbeatTimer.Elapsed += HeartbeatTimer_Elapsed; HeartbeatTimer.Start(); }
public void Can_handle_unsuccessful_login() { MockRepository mocks = new MockRepository(); ISystemUserRepository repository = mocks.CreateMock <ISystemUserRepository>(); IEncryptionEngine encryptionEngine = mocks.CreateMock <IEncryptionEngine>(); using (mocks.Record()) { Expect.Call(encryptionEngine.Encrypt("pass")).Return("encryptedPass"); Expect.Call(repository.IsValidLogin("*****@*****.**", "encryptedPass")).Return(false); } using (mocks.Playback()) { ILoginChecker loginChecker = new LoginChecker(encryptionEngine); bool isValid = loginChecker.IsValidUser("*****@*****.**", "pass", repository); Assert.That(isValid, Is.False); } mocks.VerifyAll(); }
public static void AddEngine(IEncryptionEngine engine) { s_ecryptionEngines.Add(engine); }
public ForgottenPasswordMailer(IEncryptionEngine encryptionEngine, IForgottenPasswordMailFactory mailFactory, IMailSender mailSender) { _encryptionEngine = encryptionEngine; _mailFactory = mailFactory; _mailSender = mailSender; }
public LoginChecker(IEncryptionEngine encryptionEngine) { _encryptionEngine = encryptionEngine; }