Example #1
0
 public ShortCodeFactory(IShortCodeGenerator generator, IEncoder encoder, ShortCodeOptions options, ILogger <ShortCodeFactory> logger)
 {
     _generator = generator ?? throw new ArgumentNullException(nameof(generator));
     _encoder   = encoder ?? throw new ArgumentNullException(nameof(encoder));
     _options   = options ?? throw new ArgumentNullException(nameof(options));
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
     WarnOnInconsistentOptions();
 }
        private void GenerateLots(IShortCodeGenerator gen, ulong[] result)
        {
            int count = result.Length;

            for (int i = 0; i < count; i++)
            {
                result[i] = gen.GetNextCode();
            }
        }
        private void SingleThreadStressTestImpl(IShortCodeGenerator gen, ulong[] result)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            GenerateLots(gen, result);
            sw.Stop();
            ResultReadOut(result.Length, sw);
            CheckAccuracy(result);
        }
Example #4
0
 public ShortCodeFactory(IShortCodeGenerator generator, IEncoder encoder, ShortCodeOptions options)
     : this(generator, encoder, options, new NullLogger <ShortCodeFactory>())
 {
 }