Ejemplo n.º 1
0
        public void Should_prevent_using_different_persistence_for_sagas_and_outbox()
        {
            var config = new EndpointConfiguration("MyEndpoint");

            config.UsePersistence <FakeSagaPersistence, StorageType.Sagas>();
            config.UsePersistence <FakeOutboxPersistence, StorageType.Outbox>();

            var startup = new PersistenceStartup();

            Assert.Throws <Exception>(() =>
            {
                startup.Run(config.Settings);
            }, "Sagas and Outbox need to use the same type of persistence. Saga is configured to use FakeSagaPersistence. Outbox is configured to use FakeOutboxPersistence");
        }
        public void Should_not_prevent_using_different_persistence_for_sagas_and_outbox_if_only_one_of_the_features_is_enabled(bool sagasEnabled, bool outboxEnabled)
        {
            var config = new EndpointConfiguration("MyEndpoint");

            config.UsePersistence <FakeSagaPersistence, StorageType.Sagas>();
            config.UsePersistence <FakeOutboxPersistence, StorageType.Outbox>();

            if (sagasEnabled)
            {
                config.EnableFeature <Sagas>();
            }

            if (outboxEnabled)
            {
                config.EnableFeature <Outbox>();
            }

            var startup = new PersistenceStartup();

            Assert.DoesNotThrow(() => startup.Run(config.Settings), "Should not throw for a single single feature enabled out of the two.");
        }