Exemplo n.º 1
0
        public void LoadTest()
        {
            AddConfigValue("SQSWindow", "0.00:00:15");
            //QueueMessages(10000); uncomment to do a load test
            MockSQSService service = new MockSQSService();
            Stopwatch sw = new Stopwatch();
            sw.Start();
            service.Start();

            int count = 0;
            do
            {
                count = 0;
                List<NewWindowEventArgs> windows = new List<NewWindowEventArgs>();
                windows.AddRange(service.NewWindowEventArgsReceived);
                foreach (NewWindowEventArgs args in windows)
                {
                    count += args.Messages.Count();
                }
            }
            while ((count < 10000) &
                   (sw.Elapsed.TotalSeconds < 120));
            sw.Stop();
            service.Stop();
            Assert.IsTrue(sw.Elapsed.TotalSeconds <= 120);

            RemoveConfigValue("SQSWindow");
        }
Exemplo n.º 2
0
 public void NewWindowWithNoEvents()
 {
     MockSQSService service = new MockSQSService();
     service.Start();
     Thread.Sleep(10000);
     service.Stop();
     Assert.AreEqual(1, service.NewWindowEventArgsReceived.Count);
 }
Exemplo n.º 3
0
        public void MessagesOrderedASC()
        {
            AddConfigValue("SQSWindow", "0.00:00:15");

            // add some messages to the queue
            String[] messageIds = new String[2];
            messageIds[0] = QueueMessage();
            messageIds[1] = QueueMessage();

            MockSQSService service = new MockSQSService();
            service.Start();
            PollForMessages(messageIds, service);
            service.Stop();

            int message1Index = -1;
            int message2Index = -1;

            int count = 0;
            foreach (NewWindowEventArgs arg in service.NewWindowEventArgsReceived)
            {
                count++;
                foreach (Message m in arg.Messages)
                {
                    count++;
                    if (m.MessageId == messageIds[0])
                    {
                        message1Index = count;
                    }
                    if (m.MessageId == messageIds[1])
                    {
                        message2Index = count;
                    }
                }
            }

            Assert.IsTrue(message1Index < message2Index);

            RemoveConfigValue("SQSWindow");
        }