static SqlServerSubscriptionStorage GetStorage(bool createCustomSchema) { SqlTestHelper.DropTable("Subscriptions"); var loggerFactory = new ConsoleLoggerFactory(false); var connectionProvider = new DbConnectionProvider(SqlTestHelper.ConnectionString, loggerFactory); var storage = new SqlServerSubscriptionStorage(connectionProvider, "Subscriptions", true, loggerFactory); if (createCustomSchema) { var tableName = TableName.Parse("Subscriptions"); SqlTestHelper.Execute($@" CREATE TABLE {tableName.QualifiedName} ( [topic] [nvarchar](350) NOT NULL, [address] [nvarchar](50) NOT NULL, CONSTRAINT [PK_{tableName.Schema}_{tableName.Name}] PRIMARY KEY CLUSTERED ( [topic] ASC, [address] ASC ) ) "); } else { storage.EnsureTableIsCreated(); } storage.Initialize(); return(storage); }
protected override void SetUp() { // start clean SqlTestHelper.DropAllTables(); // end clean Using(new DisposableCallback(SqlTestHelper.DropAllTables)); var loggerFactory = new ListLoggerFactory(); var connectionProvider = new DbConnectionProvider(SqlTestHelper.ConnectionString, loggerFactory); _subscriptionStorage = new SqlServerSubscriptionStorage(connectionProvider, "Subscriptions", isCentralized: true, loggerFactory); _subscriptionStorage.EnsureTableIsCreated(); _subscriptionStorage.Initialize(); _subscriberTransport = Using(new SqlServerTransport(connectionProvider, "subscriber", loggerFactory, new TplAsyncTaskFactory(loggerFactory), new FakeRebusTime(), new SqlServerTransportOptions(connectionProvider))); _subscriberTransport.EnsureTableIsCreated(); _subscriberTransport.Initialize(); }