public void Runs()
        {
            var random = new Random();
            var max    = (byte)random.Next(byte.MinValue, byte.MaxValue);
            var min    = (byte)random.Next(byte.MinValue, max);
            var count  = Substitute.For <IQueueCount>();
            var setup  = new QueueSetup <object>
            {
                Name      = "test",
                Priority  = QueuePriority.Low,
                Processor = () => { return(Substitute.For <IProcessor <object> >()); },
            };

            var connection = new QueueConnection <object>()
            {
                ConnectionString = ConnectionString,
                Setup            = setup,
            };

            var throughput = Substitute.For <IQueueThroughput>();

            throughput.Frequency(setup.Priority).Returns(new Range <byte>(min, max));

            var s    = new BusQueueAutoScaler <object>(count, connection, throughput);
            var runs = s.Runs(connection);

            Assert.IsNotNull(runs);
            Assert.AreEqual(min, runs.MinimumPeriodInSeconds);
            Assert.AreEqual(max, runs.MaximumPeriodInSeconds);

            throughput.Received().Frequency(setup.Priority);
        }
        public void Runs()
        {
            var random = new Random();
            var max = (byte)random.Next(byte.MinValue, byte.MaxValue);
            var min = (byte)random.Next(byte.MinValue, max);
            var count = Substitute.For<IQueueCount>();
            var setup = new QueueSetup<object>
            {
                Name = "test",
                Priority = QueuePriority.Low,
                Processor = () => { return Substitute.For<IProcessor<object>>(); },
            };

            var connection = new QueueConnection<object>()
            {
                ConnectionString = ConnectionString,
                Setup = setup,
            };

            var throughput = Substitute.For<IQueueThroughput>();
            throughput.Frequency(setup.Priority).Returns(new Range<byte>(min, max));

            var s = new BusQueueAutoScaler<object>(count, connection, throughput);
            var runs = s.Runs(connection);

            Assert.IsNotNull(runs);
            Assert.AreEqual(min, runs.MinimumPeriodInSeconds);
            Assert.AreEqual(max, runs.MaximumPeriodInSeconds);

            throughput.Received().Frequency(setup.Priority);
        }
        public void RunsSetupNull()
        {
            var count = Substitute.For<IQueueCount>();
            var connection = Substitute.For<IQueueConnection<object>>();

            var s = new BusQueueAutoScaler<object>(count, connection);
            s.Runs(null);
        }
        public void RunsSetupNull()
        {
            var count      = Substitute.For <IQueueCount>();
            var connection = Substitute.For <IQueueConnection <object> >();

            var s = new BusQueueAutoScaler <object>(count, connection);

            Assert.That(() => s.Runs(null), Throws.TypeOf <ArgumentNullException>());
        }