Ejemplo n.º 1
0
            public void should_produce_arbitrary_count_of_message()
            {
                var processor = new Splitter(
                    m =>
                {
                    var p = (string)m.Payload;
                    return(p
                           .ToCharArray()
                           .Select(c => c.ToString(CultureInfo.InvariantCulture)));
                });

                var message = new Message(
                    "boo".ToMessageLabel(),
                    new Dictionary <string, object> {
                    { "This", "That" }
                },
                    "Body");

                var result = processor.Apply(message).ToList();

                result.Should().HaveCount(4);
                result.Should().OnlyContain(m => m.Label.Name == "boo");
                result.Should().OnlyContain(m => m.Headers.ContainsKey("This"));
                result.Should().Contain(m => (string)m.Payload == "B");
                result.Should().Contain(m => (string)m.Payload == "o");
                result.Should().Contain(m => (string)m.Payload == "d");
                result.Should().Contain(m => (string)m.Payload == "y");
            }