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
ファイル: ZazClient.cs プロジェクト: JustApplications/zaz
 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
ファイル: AdvancedCommandBus.cs プロジェクト: wortexx/zaz
 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);
 }