public void IgnoredBestPractices_Should_Return_True_When_Disabled_Best_Practice_Enforcement()
        {
            var options = new PublishOptions();

            options.DoNotEnforceBestPractices();

            Assert.IsTrue(options.IgnoredBestPractices());
        }
        public void IgnoredBestPractices_Should_Return_True_When_Disabled_Best_Practice_Enforcement()
        {
            var options = new PublishOptions();
            
            options.DoNotEnforceBestPractices();

            Assert.IsTrue(options.IgnoredBestPractices());
        }
Example #3
0
        public async Task Should_allow_publishing_commands()
        {
            var context = await Scenario.Define <ScenarioContext>()
                          .WithEndpoint <Endpoint>(b => b.When((session, c) =>
            {
                var publishOptions = new PublishOptions();
                publishOptions.DoNotEnforceBestPractices();

                return(session.Publish(new MyCommand(), publishOptions));
            }))
                          .Done(c => c.EndpointsStarted)
                          .Run();

            Assert.True(context.EndpointsStarted);
        }
        public Task Publish(IFullMessage[] messages)
        {
            var options = new PublishOptions();

            _metrics.Mark("Dispatched Messages", Unit.Message);

            // Todo: publish would only be called for messages on a single stream
            // we can set a routing key somehow for BulkMessage so its routed to the same sharded queue
            var message = new BulkMessage
            {
                Messages = messages
            };

            // Publishing an IMessage normally creates a warning
            options.DoNotEnforceBestPractices();

            return(Bus.Instance.Publish(message, options));
        }
        public Task Should_allow_publishing_commands()
        {
            return(Scenario.Define <ScenarioContext>()
                   .WithEndpoint <Endpoint>(b => b.When((session, c) =>
            {
                var publishOptions = new PublishOptions();
                publishOptions.DoNotEnforceBestPractices();

                return session.Publish(new MyCommand(), publishOptions);
            }))
                   .Done(c => c.EndpointsStarted)
                   // This test is only relevant for message driven transports since we need to use the mappings to
                   // configure the publisher. The code first API would blow up unless we turn off the checks for the entire endpoint.
                   // But if we do that turning off checks per message becomes pointless since they are already off.
                   // We would need a new api to turn off startup checks only for this to be testable across the board.
                   .Repeat(r => r.For <AllTransportsWithMessageDrivenPubSub>())
                   .Should(c => Assert.True(c.EndpointsStarted))
                   .Run());
        }