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();
            }
        }
예제 #3
0
 public ZazClient(string url, ZazConfiguration configuration = null)
 {
     _underlineClient = new AdvancedZazClient(url, configuration);
 }
예제 #4
0
 public AdvancedZazClient(string url, ZazConfiguration configuration = null)
 {
     _client = new ZazServerClient(url, configuration);
 }
예제 #5
0
 public AdvancedCommandBus(string url, ZazConfiguration configuration = null)
 {
     _client = new CommandBusClient(url, configuration);
 }
예제 #6
0
파일: CommandBus.cs 프로젝트: wortexx/zaz
 public CommandBus(string url, ZazConfiguration configuration = null)
 {
     _underlineBus = new AdvancedCommandBus(url, configuration);
 }