public void WithObject_returns_this()
        {
            var builder = new AzureIntegrationMessageBuilder();

            var @return = builder.WithObject(_integrationEvent);

            @return.ShouldBe <IBusMessageBuilder <IIntegrationEvent, Message> >(builder);
        }
        public void Build_returns_AzureServiceBusMessage()
        {
            var builder = new AzureIntegrationMessageBuilder();

            builder.WithObject(_integrationEvent);

            var message = builder.Build();

            message.ShouldBeOfType <Message>();
        }
        public void Build_returns_message_wrapping_provided_event()
        {
            var builder = new AzureIntegrationMessageBuilder();

            var message = builder
                          .WithObject(_integrationEvent)
                          .Build();

            dynamic deserializedEvent = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(message.Body));

            ((string)deserializedEvent["SomeProperty"]).ShouldBe("Hello world");
        }
        public void Build_contains_message_with_expected_properties()
        {
            var builder = new AzureIntegrationMessageBuilder();

            var message = builder
                          .WithObject(_integrationEvent)
                          .Build();

            message.ShouldSatisfyAllConditions(
                () => message.ContentType.ShouldBe("application/json"),
                () => message.Label.ShouldBe("TestIntegrationEvent"),
                () => message.MessageId.ShouldNotBe(default(Guid).ToString()),
                () => message.UserProperties["Publisher"].ShouldBe(ApplicationInfo.Name));
        }