public void Should_stream_the_event() { // Given var bootstrapper = new ConfigurableBootstrapper(config => { config.Modules(typeof(DashingModule)); }); var browser = new Browser(bootstrapper); var client = A.Dummy <EventStreamWriterResponse>(); ClientBus.Register(client); // When var result = browser.Post("/widgets/number", with => { with.HttpRequest(); with.JsonBody(new { current = 123 }); }); // Then A.CallTo(() => client.Write(null)) .WhenArgumentsMatch(args => args[0].ToExpando().id == "number" && args[0].ToExpando().current == 123) .MustHaveHappened(); }
private static void RunClient(Stream serverStream, List <string> extraDlls, SystemConfiguration?config = null) { var runtime = XTMFRuntime.CreateRuntime(config); var loadedConfig = runtime.SystemConfiguration; foreach (var dll in extraDlls) { loadedConfig.LoadAssembly(dll); } using var clientBus = new ClientBus(serverStream, true, runtime, extraDlls); clientBus.ProcessRequests(); }
public async Task Should_match_the_endpoint_binding() { var endpoint = await ClientBus.GetSendEndpoint(new Uri("exchange:test-exchange?type=topic")); await endpoint.Send(new A { Value = "Bad" }, x => x.SetRoutingKey("bus.red.large")); await endpoint.Send(new A { Value = "Bad" }, x => x.SetRoutingKey("car.green.small")); await endpoint.Send(new A { Value = "Bad" }, x => x.SetRoutingKey("bus.green.small")); await endpoint.Send(new A { Value = "Good" }, x => x.SetRoutingKey("car.blue.large")); ConsumeContext <A> handled = await _handled; Assert.That(handled.Message.Value, Is.EqualTo("Good")); }
public async Task Should_get_the_job_accepted() { IRequestClient <SubmitJob <EncodeVideo> > requestClient = ClientBus.CreateRequestClient <SubmitJob <EncodeVideo> >(); Response <JobSubmissionAccepted> response = await requestClient.GetResponse <JobSubmissionAccepted>(new { JobId = _jobId, Job = new { VideoId = _jobId, Path = "C:\\Downloads\\RickRoll.mp4", Duration = 1 } }); Assert.That(response.Message.JobId, Is.EqualTo(_jobId)); // just to capture all the test output in a single window ConsumeContext <JobCompleted> completed = await _completed; }
public async Task Should_get_the_job_accepted() { IRequestClient <SubmitJob <EncodeVideo> > requestClient = ClientBus.CreateRequestClient <SubmitJob <EncodeVideo> >(); for (var i = 0; i < Count; i++) { Response <JobSubmissionAccepted> response = await requestClient.GetResponse <JobSubmissionAccepted>(new { JobId = _jobIds[i], Job = new { VideoId = _jobIds[i], Path = "C:\\Downloads\\RickRoll.mp4", Duration = 1 } }); } ConsumeContext <JobCompleted>[] completed = await Task.WhenAll(_completed.Select(x => x.Task)); }
public async Task Should_cross_the_border() { await ClientBus.Publish(new A()); await _receivedA; }
public ClientController() { objClientBus = new ClientBus(); }