public ShortUrlGenerator( IFromShortUrlRepository fromShortUrlRepository, IRandomStringGenerator randomStringGenerator) { this.fromShortUrlRepository = fromShortUrlRepository; this.randomStringGenerator = randomStringGenerator; }
public UnitOfWork( DbContext dbContext, IRandomStringGenerator randomStringGenerator) { DbContext = dbContext; RandomStringGenerator = randomStringGenerator; }
public RepositorySeeder( IUnitOfWork uow, IRandomStringGenerator randomStringGenerator) { Uow = uow; RandomStringGenerator = randomStringGenerator; }
public ClaimCodeGenerator(int length, int interval, string seperator, IRandomStringGenerator randomStringGenerator) { _length = length; _interval = interval; _seperator = seperator; _randomStringGenerator = randomStringGenerator; }
internal ScramSha256Authenticator( UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator, ServerApi serverApi) : base(credential, HashAlgorithmName.SHA256, randomStringGenerator, H256, Hi256, Hmac256, new ScramCache(), serverApi) { }
public CreateQuizCommandHandler(DataContext context, IRandomStringGenerator stringGenerator, ICustomMapper customMapper) { _context = context; _stringGenerator = stringGenerator; _customMapper = customMapper; }
public void GivenRandomStringGeneratorWhenRandomStringsGeneratedThenAllCharactersAreUsed() { ISet <char> alphaChars = new HashSet <char> { '0', '1', '2', '3', '4', '5' }; ISet <char> foundChars = new HashSet <char>(); string alpha = string.Join("", alphaChars); int maxIterations = 100; int rndStringLength = 4; IRandomStringGenerator generator = NewGenerator(); for (int index = 0; index < maxIterations; index++) { string rnd = generator.RandomString(rndStringLength, alpha); char[] rndChars = rnd.ToCharArray(); foreach (char c in rndChars) { foundChars.Add(c); } if (alphaChars.Count == foundChars.Count) { Assert.Pass("All chars found at index: " + index); } } Assert.Fail(string.Format("Not all characters found in random strings. Found: '{0}'", string.Join(", ", alphaChars))); }
internal DefaultAuthenticator( UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator, ServerApi serverApi) { _credential = Ensure.IsNotNull(credential, nameof(credential)); _randomStringGenerator = Ensure.IsNotNull(randomStringGenerator, nameof(randomStringGenerator)); _serverApi = serverApi; }
public StringEditViewModel(ICharacterSetProvider stringConfiguration, ICharacterSetService characterSetService, IRandomStringGenerator randomStringGenerator) { this.stringConfiguration = stringConfiguration; this.characterSetService = characterSetService; this.randomStringGenerator = randomStringGenerator; GenerateCommand = new RelayCommand(RunGenerate, CanExecuteGenerate); AddCharactersCommand = new RelayCommand(RunGenerate, CanExecuteGenerate); RemoveCharactersCommand = new RelayCommand(RunRemoveCharacters, CanExecuteRemoveCharacters); }
public VermittlerNoGenerator( IInsuranceDbContext insuranceDbContext, IRandomStringGenerator randomStringGenerator, ILogger <VermittlerNoGenerator> logger) { _insuranceDbContext = insuranceDbContext; _randomStringGenerator = randomStringGenerator; _logger = logger; }
public ChunkGenerator( IChunkInfoBuilder chunkInfoBuilder, IRandomNumberGenerator randomNumberGenerator, IRandomStringGenerator randomStringGenerator) { _randomNumberGenerator = randomNumberGenerator; _randomStringGenerator = randomStringGenerator; _chunkInfoBuilder = chunkInfoBuilder; }
public CreateToken(IClockProvider clockProvider, IEncryptionProvider encryptionProvider, IRandomStringGenerator randomStringGenerator, IRequestTokenService requestTokenService) { _clockProvider = clockProvider; _encryptionProvider = encryptionProvider; _randomStringGenerator = randomStringGenerator; _requestTokenService = requestTokenService; }
public DefaultPathNameGenerator( string prefix = "", string postfix = "", int randomLength = 5, IRandomStringGenerator?nameGenerator = default) { _nameGenerator = nameGenerator ?? new RandomStringGenerator(); _prefix = prefix; _postfix = postfix; _randomLength = randomLength; }
/// <summary> /// Initializes a new instance of the <see cref="ScramShaAuthenticator"/> class. /// </summary> /// <param name="credential">The credential.</param> /// <param name="hashAlgorithName">The hash algorithm name.</param> /// <param name="randomStringGenerator">The random string generator.</param> /// <param name="h">The H function to use.</param> /// <param name="hi">The Hi function to use.</param> /// <param name="hmac">The Hmac function to use.</param> internal ScramShaAuthenticator( UsernamePasswordCredential credential, HashAlgorithmName hashAlgorithName, IRandomStringGenerator randomStringGenerator, H h, Hi hi, Hmac hmac) : base(new ScramShaMechanism(credential, hashAlgorithName, randomStringGenerator, h, hi, hmac)) { _databaseName = credential.Source; }
public LoginOtpService(ILoginOtpRepository loginOtpRepository, IConfigurationSettingRepository configurationSettingRepository, IRandomStringGenerator randomStringGenerator, INotifier notifier, IPhoneNotificationModelsFactory smsNotificationModelsFactory, IEmailNotificationModelsFactory emailNotificationModelsFactory, ILoginSettingRepository loginSettingRepository, ISessionContext sessionContext) { _loginOtpRepository = loginOtpRepository; _configurationSettingRepository = configurationSettingRepository; _randomStringGenerator = randomStringGenerator; _notifier = notifier; _smsNotificationModelsFactory = smsNotificationModelsFactory; _emailNotificationModelsFactory = emailNotificationModelsFactory; _loginSettingRepository = loginSettingRepository; _sessionContext = sessionContext; }
public void GivenRandomStringGeneratorWhen1000StringsGeneratedThenNoDuplicatesFound() { int rndStringLength = 6; int maxIterations = 1000; IRandomStringGenerator generator = NewGenerator(); ISet <string> resultSet = new HashSet <string>(); for (int index = 0; index < maxIterations; index++) { string rnd = generator.RandomAlphaNumericUpperCaseString(rndStringLength); Assert.False(resultSet.Contains(rnd), string.Format("Duplicate random string found '{0}' at index {1}", rnd, index)); resultSet.Add(rnd); } }
public CampaignService(ICampaignRepository campaignRepository, ICampaignActivityRepository campaignActivityRepository, ICampaignAssignmentRepository campaignAssignmentRepository, ICampaignActivityAssignmentRepository campaignActivityAssignmentRepository, IOrganizationRoleUserRepository organizationRoleUserRepository, ICampaignListModelFactory campaignListModelFactory, ICorporateAccountRepository corporateAccountRepository, IRandomStringGenerator randomStringGenerator, IDirectMailTypeRepository directMailTypeRepository) { _campaignRepository = campaignRepository; _campaignActivityRepository = campaignActivityRepository; _campaignAssignmentRepository = campaignAssignmentRepository; _campaignActivityAssignmentRepository = campaignActivityAssignmentRepository; _organizationRoleUserRepository = organizationRoleUserRepository; _campaignListModelFactory = campaignListModelFactory; _corporateAccountRepository = corporateAccountRepository; _randomStringGenerator = randomStringGenerator; _directMailTypeRepository = directMailTypeRepository; }
public AccountService( IDinnerPrincipalProvider principalProvider, IAuthStorage authStorage, IPasswordHashProvider passwordHashProvider, IUserDinnerStorage userDinnerStorage, IRandomStringGenerator stringGenerator, IEmailSystem emailSystem) { this.principalProvider = principalProvider; this.authStorage = authStorage; this.passwordHashProvider = passwordHashProvider; this.userDinnerStorage = userDinnerStorage; this.stringGenerator = stringGenerator; this.emailSystem = emailSystem; }
public AddDocumentAssetCommandHandler( CofoundryDbContext dbContext, EntityAuditHelper entityAuditHelper, EntityTagHelper entityTagHelper, DocumentAssetCommandHelper documentAssetCommandHelper, ITransactionScopeManager transactionScopeFactory, IMessageAggregator messageAggregator, IRandomStringGenerator randomStringGenerator ) { _dbContext = dbContext; _entityAuditHelper = entityAuditHelper; _entityTagHelper = entityTagHelper; _documentAssetCommandHelper = documentAssetCommandHelper; _transactionScopeFactory = transactionScopeFactory; _messageAggregator = messageAggregator; _randomStringGenerator = randomStringGenerator; }
public ScramShaMechanism( UsernamePasswordCredential credential, HashAlgorithmName hashAlgorithmName, IRandomStringGenerator randomStringGenerator, H h, Hi hi, Hmac hmac) { _credential = Ensure.IsNotNull(credential, nameof(credential)); _h = h; _hi = hi; _hmac = hmac; if (!hashAlgorithmName.ToString().StartsWith("SHA")) { throw new ArgumentException("Must specify a SHA algorithm."); } _name = $"SCRAM-SHA-{hashAlgorithmName.ToString().Substring(3)}"; _randomStringGenerator = Ensure.IsNotNull(randomStringGenerator, nameof(randomStringGenerator)); }
public AddImageAssetCommandHandler( CofoundryDbContext dbContext, EntityAuditHelper entityAuditHelper, EntityTagHelper entityTagHelper, IImageAssetFileService imageAssetFileService, ITransactionScopeManager transactionScopeFactory, IMessageAggregator messageAggregator, IRandomStringGenerator randomStringGenerator, IAssetFileTypeValidator assetFileTypeValidator ) { _dbContext = dbContext; _entityAuditHelper = entityAuditHelper; _entityTagHelper = entityTagHelper; _imageAssetFileService = imageAssetFileService; _transactionScopeFactory = transactionScopeFactory; _messageAggregator = messageAggregator; _randomStringGenerator = randomStringGenerator; _assetFileTypeValidator = assetFileTypeValidator; }
public TestMe(ITestManager testManager, ITestQuestionManager testQuestionManager, ITestAnswerManager testAnswerManager, ITestResultManager testResultManager, IRandomStringGenerator randomStringGenerator, IAnswerImageManager answerImageManager, ITestReportManager testReportManager, ITestMarkManager testMarkManager, IUserAnswerManager userAnswerManager) { TestManager = testManager; TestQuestionManager = testQuestionManager; TestAnswerManager = testAnswerManager; TestResultManager = testResultManager; RandomStringGenerator = randomStringGenerator; AnswerImageManager = answerImageManager; TestReportManager = testReportManager; TestMarkManager = testMarkManager; UserAnswerManager = userAnswerManager; }
public void GivenRandomStringGeneratorWhenRandomStringsGeneratedThenAllCharactersHaveEvenDistributionWithin10Percent() { ISet <char> alphaChars = new HashSet <char> { '0', '1', '2', '3', '4', '5' }; IDictionary <char, int> charCount = new Dictionary <char, int>(); string alpha = string.Join("", alphaChars); int maxIterations = 10000; int rndStringLength = 1; IRandomStringGenerator generator = NewGenerator(); for (int index = 0; index < maxIterations; index++) { string rnd = generator.RandomString(rndStringLength, alpha); char[] rndChars = rnd.ToCharArray(); foreach (char c in rndChars) { if (charCount.ContainsKey(c)) { charCount[c]++; } else { charCount.Add(c, 1); } } } double expectedCharCount = (maxIterations * rndStringLength) / alphaChars.Count; double delta = expectedCharCount * 0.1; foreach (var pair in charCount) { Assert.AreEqual(expectedCharCount, pair.Value, delta, "Character distribution for char '{0}' not even", pair.Key); } }
public QuizDetailEndpoint(IQuizService service, IRandomStringGenerator generator) { _service = service; _generator = generator; }
public ScramSha1Mechanism(UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator) { _credential = Ensure.IsNotNull(credential, "credential"); _randomStringGenerator = Ensure.IsNotNull(randomStringGenerator, "randomStringGenerator"); }
internal ScramSha1Authenticator(UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator) : base(new ScramSha1Mechanism(credential, randomStringGenerator)) { _databaseName = credential.Source; }
public SubscriptionStorage(IRandomStringGenerator rsg, SubscriptionContext db) { _rsg = rsg; _db = db; }
internal ScramSha1Authenticator(UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator) : base(credential, HashAlgorithmName.SHA1, randomStringGenerator, H1, Hi1, Hmac1, new ScramCache()) { }
internal ScramSha256Authenticator(UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator) : base(credential, HashAlgorithmName.SHA256, randomStringGenerator, H256, Hi256, Hmac256) { }
internal DefaultAuthenticator(UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator) { _credential = Ensure.IsNotNull(credential, "credential"); _randomStringGenerator = Ensure.IsNotNull(randomStringGenerator, "randomStringGenerator"); }
public RandomStringGeneratorTests() { _stringGenerator = new RandomBase64StringGenerator(); }
public ScramSha1Mechanism(UsernamePasswordCredential credential, IRandomStringGenerator randomStringGenerator) { _credential = Ensure.IsNotNull(credential, nameof(credential)); _randomStringGenerator = Ensure.IsNotNull(randomStringGenerator, nameof(randomStringGenerator)); }
public TodoItemRepository( DbContext dbContext, IRandomStringGenerator randomStringGenerator) : base(dbContext) { RandomStringGenerator = randomStringGenerator; }