public void SetUp() { var config = new HttpSelfHostConfiguration(URL); ZazServer.Configure(config, Prefix1, new ServerConfiguration { Registry = new FooCommandRegistry(), Broker = new DelegatingCommandBroker((o, context) => { _api1Command = (FooCommand)o; return Task.Factory.StartNew(() => { }); }), }); ZazServer.Configure(config, Prefix2, new ServerConfiguration { Registry = new FooCommandRegistry(), Broker = new DelegatingCommandBroker((o, context) => { _api2Command = (FooCommand)o; return Task.Factory.StartNew(() => { }); }), }); _host = new HttpSelfHostServer(config); _host.OpenAsync().Wait(); }
public void Should_despatch_commands_between_controllers_by_prefixes() { var client1 = new ZazClient(URL1); var client2 = new ZazClient(URL2); var cmd1 = new FooCommand { Message = "Command #1" }; var cmd2 = new FooCommand { Message = "Command #2" }; client1.PostAsync(cmd1).Wait(); client2.PostAsync(cmd2).Wait(); _api1Command.Message.Should().Be(cmd1.Message); _api2Command.Message.Should().Be(cmd2.Message); }