public PageComposer(INavigationService navigator) { if (navigator == null) { throw new ArgumentNullException(nameof(navigator)); } // initialisation des dépendances avec un cycle de vie de singleton this.navigator = navigator; fileService = new WindowsFileService(); articlePictureSettings = CreateArticlePictureSettings(); articlePictureNameFormatter = new ArticlePictureNameFormatter( articlePictureSettings); pictureLocator = new ArticlePictureLocator( fileService, articlePictureNameFormatter, articlePictureSettings); passwordHashGenerator = new PasswordHashGenerator(); passwordHashComparer = new PasswordHashComparer(); messageBoxDialogService = new MessageBoxDialogService(); CreatePictureFolderIfDoesNotExist(); CreateDatabaseIfDoesNotExist(); }
private Authenticator CreateAuthenticator(IPasswordHashComparer passwordHashComparer) { var authenticator = new Authenticator( CreateStubCredentialsReader(), passwordHashComparer); return(authenticator); }
public void Constructor_NullPasswordHashComparerPassed_Throws() { var stubCredentialsReader = Substitute.For <ICredentialsReader>(); IPasswordHashComparer nullPasswordHashComparer = null; var exception = Assert.Catch <ArgumentNullException>( () => new Authenticator( stubCredentialsReader, nullPasswordHashComparer)); }
public bool MatchWith( UnhashedPassword unhashedPassword, IPasswordHashComparer hashComparer) { if (unhashedPassword == null) { throw new ArgumentNullException(nameof(unhashedPassword)); } if (hashComparer == null) { throw new ArgumentNullException(nameof(hashComparer)); } return(hashComparer.AreMatching(this, unhashedPassword)); }
public Authenticator( ICredentialsReader credentialsReader, IPasswordHashComparer passwordHashComparer) { if (credentialsReader == null) { throw new ArgumentNullException(nameof(credentialsReader)); } if (passwordHashComparer == null) { throw new ArgumentNullException(nameof(passwordHashComparer)); } this.credentialsReader = credentialsReader; this.passwordHashComparer = passwordHashComparer; }