Ejemplo n.º 1
0
        public void Reading_without_receiving_should_return_the_same_set_of_messages()
        {
            LocalEndpoint.Send(new PingMessage());

            int count = 0;

            foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds()))
            {
                object message = selector.DeserializeMessage();
                Assert.IsInstanceOfType(typeof(PingMessage), message);

                count++;
            }

            int secondCount = 0;

            foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds()))
            {
                object message = selector.DeserializeMessage();
                Assert.IsInstanceOfType(typeof(PingMessage), message);

                secondCount++;
            }

            Assert.AreEqual(1, count);
            Assert.AreEqual(1, secondCount);
        }
Ejemplo n.º 2
0
 private void PurgeEndpoint()
 {
     foreach (var selector in LocalEndpoint.SelectiveReceive(10.Milliseconds()))
     {
         selector.AcceptMessage();
     }
 }
Ejemplo n.º 3
0
        public void Reading_from_an_empty_queue_should_just_return_an_empty_enumerator()
        {
            int count = 0;

            foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds()))
            {
                selector.AcceptMessage();
                count++;
            }

            Assert.AreEqual(0, count);
        }
Ejemplo n.º 4
0
        public void Reading_a_single_message_should_return_one_message_selector()
        {
            LocalEndpoint.Send(new PingMessage());

            int count = 0;

            foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds()))
            {
                selector.AcceptMessage();
                count++;
            }

            Assert.AreEqual(1, count);
        }
Ejemplo n.º 5
0
        public void Receiving_the_message_and_accepting_it_should_make_it_go_away()
        {
            LocalEndpoint.Send(new PingMessage());

            foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds()))
            {
                object message = selector.DeserializeMessage();
                Assert.IsInstanceOfType(typeof(PingMessage), message);

                Assert.IsTrue(selector.AcceptMessage());
            }

            int count = 0;

            foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds()))
            {
                count++;
            }

            Assert.AreEqual(0, count);
        }