コード例 #1
0
        public void CreateProcessor_ReturnsExpectedProcessor()
        {
            string defaultConnection = "Endpoint=sb://default.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123=";
            var    config            = new ServiceBusOptions
            {
                ConnectionString = defaultConnection
            };
            var provider  = new MessagingProvider(new OptionsWrapper <ServiceBusOptions>(config));
            var processor = provider.CreateProcessor("entityPath", defaultConnection);

            Assert.AreEqual("entityPath", processor.EntityPath);

            var processor2 = provider.CreateProcessor("entityPath", defaultConnection);

            Assert.AreSame(processor, processor2);

            config.PrefetchCount              = 100;
            config.MaxConcurrentCalls         = 5;
            config.MaxAutoLockRenewalDuration = TimeSpan.FromSeconds(30);
            processor = provider.CreateProcessor("entityPath1", defaultConnection);
            Assert.AreEqual(config.PrefetchCount, processor.PrefetchCount);
            Assert.AreEqual(config.MaxConcurrentCalls, processor.MaxConcurrentCalls);
            Assert.AreEqual(config.MaxAutoLockRenewalDuration, processor.MaxAutoLockRenewalDuration);
        }