public void Should_successfully_send_command() { Action send = () => { var configuration = new ZazConfiguration(); configuration.SetupSimpleBasicAuthentication("user", "unknown"); var bus = new ZazClient(URL, configuration); bus.PostAsync(new FooCommand { Message = "Hello world" }).Wait(); }; send.ShouldThrow<Exception>(); }
public void Given_command_server_runnig() { var serverConfiguration = new ServerConfiguration { Registry = new FooCommandRegistry(), Broker = new DelegatingCommandBroker((cmd, ctx) => { _postedCommand = cmd; _ctx = ctx; _principal = Thread.CurrentPrincipal; return Task.Factory.StartNew(() => { }); }), ConfigureHttp = http => http.SetupBasicAuthentication("supr", "booper", "") }; var config = ZazServer.ConfigureAsSelfHosted(URL, serverConfiguration); _host = new HttpSelfHostServer(config); //SimpleBasicAuthenticationHandler.Configure(config, cred => cred.UserName == "supr" && cred.Password == "booper"); using (new HttpSelfHostServer(config)) { _host.OpenAsync().Wait(); // Client side var configuration = new ZazConfiguration(); configuration.SetupSimpleBasicAuthentication("supr", "booper"); var client = new ZazClient(URL, configuration); client.PostAsync(new FooCommand { Message = "Hello world" }).Wait(); } }
public ZazClient(string url, ZazConfiguration configuration = null) { _underlineClient = new AdvancedZazClient(url, configuration); }
public AdvancedZazClient(string url, ZazConfiguration configuration = null) { _client = new ZazServerClient(url, configuration); }
public AdvancedCommandBus(string url, ZazConfiguration configuration = null) { _client = new CommandBusClient(url, configuration); }
public CommandBus(string url, ZazConfiguration configuration = null) { _underlineBus = new AdvancedCommandBus(url, configuration); }