public void It_should_be_easy_to_build_and_send_a_group_of_messages() { var createOrder = new CreateOrder(_transactionId); var orderItemList = new List <AddOrderItem>(); CorrelatedMessageGroup <Guid> messageGroup = createOrder.CombineWith(orderItemList.ToArray()); Assert.AreEqual(1, messageGroup.Count()); }
public static CorrelatedMessageGroup <TKey> CombineWith <TMessage, TKey>(this CorrelatedBy <TKey> message, params TMessage[] messages) where TMessage : CorrelatedBy <TKey> { var group = new CorrelatedMessageGroup <TKey> { message }; group.AddRange(messages); return(group); }
public void Multiple_groups_should_be_combinable_into_a_single_group() { var createOrder = new CreateOrder(_transactionId); var orderItemList = new List <AddOrderItem> { new AddOrderItem(_transactionId), new AddOrderItem(_transactionId) }; CorrelatedMessageGroup <Guid> messageGroup = createOrder.CombineWith(orderItemList.ToArray()); CorrelatedMessageGroup <Guid> secondGroup = new AddOrderItem(_transactionId).CombineWith(new AddOrderItem(_transactionId)); messageGroup.CombineWith(secondGroup); Assert.AreEqual(5, messageGroup.Count()); }