Exemplo n.º 1
0
        public void Send_should_send_a_non_empty_string()
        {
            //A
            string result = "";

            RunWithRabbitLocalChannelAndQueue(
                "Send_should_send",
                (channel, queueName) =>
            {
                //A
                T1HelloWorld.SendHello(channel, queueName);
                result = ListenForFirstMessage(channel, queueName);
            }
                );

            //A
            Assert.Greater(result.Length, 0);
        }
Exemplo n.º 2
0
        public void Receive_should_receive_whatever_was_sent()
        {
            //Expect
            string testSend = "Test Send " + Guid.NewGuid();

            using (var writer = new StringWriter())
            {
                //A
                RunWithRabbitLocalChannelAndQueue(
                    "Receive_should_receive",
                    (c, q) => {
                    c.BasicPublish("", q, null, Encoding.UTF8.GetBytes(testSend));
                    T1HelloWorld.ConsoleLogEachMessageInQueue(c, q, writer, TimeSpan.FromMilliseconds(250));
                }
                    );

                //A
                Assert.That(writer.ToString(), Contains.Substring(testSend));
            }
        }