コード例 #1
0
        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();
        }
コード例 #2
0
        private Authenticator CreateAuthenticator(IPasswordHashComparer passwordHashComparer)
        {
            var authenticator = new Authenticator(
                CreateStubCredentialsReader(),
                passwordHashComparer);

            return(authenticator);
        }
コード例 #3
0
        public void Constructor_NullPasswordHashComparerPassed_Throws()
        {
            var stubCredentialsReader = Substitute.For <ICredentialsReader>();
            IPasswordHashComparer nullPasswordHashComparer = null;

            var exception = Assert.Catch <ArgumentNullException>(
                () => new Authenticator(
                    stubCredentialsReader,
                    nullPasswordHashComparer));
        }
コード例 #4
0
ファイル: HashedPassword.cs プロジェクト: BjcSoftware/EBana
        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));
        }
コード例 #5
0
        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;
        }