예제 #1
0
        public void Node_a_should_recieve_all_the_work()
        {
            var       generator = new LoadGenerator <FirstCommand, FirstResponse>();
            const int count     = 100;

            generator.Run(RemoteBus, count, x => new FirstCommand(x));

            Dictionary <Uri, int> results = generator.GetWorkerLoad();

            Assert.That(results.Sum(x => x.Value), Is.EqualTo(count));
            Assert.That(results[_nodes["A"]], Is.EqualTo(count));
        }
예제 #2
0
        public void Using_the_load_generator_should_share_the_load()
        {
            var       generator = new LoadGenerator <FirstCommand, FirstResponse>();
            const int count     = 100;

            generator.Run(RemoteBus, count, x => new FirstCommand(x));

            Dictionary <Uri, int> results = generator.GetWorkerLoad();

            Assert.That(results.Sum(x => x.Value), Is.EqualTo(count));
            results.ToList().ForEach(x =>
                                     Assert.That(x.Value, Is.GreaterThan(0).And.LessThanOrEqualTo(count),
                                                 string.Format("{0} did not consume between 0 and {1}",
                                                               x.Key.ToString(), count)));
        }
예제 #3
0
		public void Node_a_should_recieve_all_the_work()
		{
			var generator = new LoadGenerator<FirstCommand, FirstResponse>();
			const int count = 100;

			generator.Run(RemoteBus, count, x => new FirstCommand(x));

			Dictionary<Uri, int> results = generator.GetWorkerLoad();

			Assert.That(results.Sum(x => x.Value), Is.EqualTo(count));
			Assert.That(results[_nodes["A"]], Is.EqualTo(count));
		}
예제 #4
0
		public void Using_the_load_generator_should_share_the_load()
		{
			var generator = new LoadGenerator<FirstCommand, FirstResponse>();
			const int count = 100;

			generator.Run(RemoteBus, count, x => new FirstCommand(x));

			Dictionary<Uri, int> results = generator.GetWorkerLoad();

			Assert.That(results.Sum(x => x.Value), Is.EqualTo(count));
			results.ToList().ForEach(x =>
			                         Assert.That(x.Value, Is.GreaterThan(0).And.LessThanOrEqualTo(count),
			                         	string.Format("{0} did not consume between 0 and {1}",
			                         		x.Key.ToString(), count)));
		}