コード例 #1
0
        public async Task Test()
        {
            await using var sender = _bus.CreateSender("orders");
            var publisher = new Publisher(sender);

            await _admin.Setup("orders", "ServiceA", "CreateOrder");

            await _bus
            .CreateProcessor("orders", "ServiceA")
            .Hookup(new ServiceA(publisher))
            .StartProcessingAsync();

            await _admin.Setup("orders", "test", "OrderCreated");

            var test = new Subscriber <OrderCreated>();
            await _bus
            .CreateProcessor("orders", "test")
            .Hookup(test)
            .StartProcessingAsync();

            var order = Generator.NewOrder();
            await publisher.Publish("CreateOrder", order, DateTimeOffset.UtcNow);

            await test.Assert(x => x.Should().BeEquivalentTo(order), TimeSpan.FromSeconds(10));
        }
コード例 #2
0
        public static async Task Setup(this ServiceBusAdministrationClient admin, string topic, string subscription, string @event)
        {
            await admin.Setup(topic);

            await admin.Setup(topic, subscription);

            await admin.Delete(topic, subscription, "$Default");

            await admin.SetupRule(topic, subscription, @event);
        }