Skip to content
This repository
tree: 9e882bcaa8
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 44 lines (33 sloc) 1.346 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
namespace ZeroMQ.AcceptanceTests.ZmqSocketSpecs
{
    using AcceptanceTests;

    using Machine.Specifications;

[Subject("SendMessage/ReceiveMessage")]
    class when_transferring_multipart_messages : using_threaded_req_rep
    {
        protected static ZmqMessage message;
        protected static SendStatus sendResult1;
        protected static SendStatus sendResult2;

        Establish context = () =>
        {
            senderAction = req =>
            {
                sendResult1 = sendResult2 = req.SendMessage(new ZmqMessage(new[] { Messages.MultiFirst, Messages.MultiLast }));
            };

            receiverAction = rep =>
            {
                message = rep.ReceiveMessage();
            };
        };

        Because of = StartThreads;

        Behaves_like<CompleteMessageReceived> successfully_received_single_message;

        It should_be_a_complete_message = () =>
            message.IsComplete.ShouldBeTrue();

        It should_not_be_an_empty_message = () =>
            message.IsEmpty.ShouldBeFalse();

        It should_contain_the_correct_number_of_frames = () =>
            message.FrameCount.ShouldEqual(2);

        It should_contain_the_correct_number_of_bytes = () =>
            message.TotalSize.ShouldEqual(Messages.MultiFirst.MessageSize + Messages.MultiLast.MessageSize);
    }
}
Something went wrong with that request. Please try again.