public static void Init() { var bus = new Bus(); var cashier = new Cashier(bus); var barista = new Barista(Guid.NewGuid(), bus); var repository = new SagaRepository<OrderFufillment>(bus); bus.RouteToSaga(repository, (DrinkOrdered e) => e.OrderId); bus.RouteToSaga(repository, (DrinkPrepared e) => e.OrderId); bus.RouteToSaga(repository, (PaymentReceived e) => e.OrderId); bus.Register<OrderDrink>(c => cashier.Order(c.OrderId, c.Drink)); bus.RegisterOnThreadPool<Pay>(c => cashier.Pay(c.OrderId, PaymentMethod.CreditCard, c.Amount)); bus.RegisterOnThreadPool<PrepareDrink>(c => barista.PrepareDrink(c.OrderId, c.Drink)); bus.Register<NotifyCustomer>(c => { Console.WriteLine("{0} is ready", c.OrderId); ThreadPool.QueueUserWorkItem(_ => bus.Send(new Pay { OrderId = c.OrderId, Amount = 12m })); }); ServiceLocator.RegisterDispatcher<Command>(bus.Send); WindowsCommunicationFoundation.RegisterServiceLayer<Sales>(); }
public void Send_Null_Throws() { var transport = A.Fake<ITransport>(); var bus = new Bus("myQueue"); bus.Transport = transport; bus.Start(); Assert.Throws<ArgumentNullException>(() => bus.Send<string>(null)); }
public void Send_NotConfigured_Throws() { var transport = A.Fake<ITransport>(); var bus = new Bus("myQueue"); bus.Transport = transport; string someData = "some made up data"; Assert.Throws<InvalidOperationException>(() => bus.Send(someData)); }
private static void Main(string[] args) { var bus = new Bus(); var cashier = new Cashier(bus); var barista = new Barista(Guid.NewGuid(), bus); var repository = new SagaRepository<OrderFufillment>(bus); bus.RouteToSaga(repository, (DrinkOrdered e) => e.OrderId); bus.RouteToSaga(repository, (DrinkPrepared e) => e.OrderId); bus.RouteToSaga(repository, (PaymentReceived e) => e.OrderId); bus.Register<OrderDrink>(c => cashier.Order(c.OrderId, c.Drink)); bus.RegisterOnThreadPool<Pay>(c => cashier.Pay(c.OrderId, PaymentMethod.CreditCard, c.Amount)); bus.RegisterOnThreadPool<PrepareDrink>(c => barista.PrepareDrink(c.OrderId, c.Drink)); bus.Register<NotifyCustomer>(c => { Console.WriteLine("{0} is ready", c.OrderId); ThreadPool.QueueUserWorkItem(_ => bus.Send(new Pay { OrderId = c.OrderId, Amount = 12m })); }); Guid orderId = Guid.NewGuid(); bus.Send(new OrderDrink {Drink = Drinks.Cappucino, OrderId = orderId}); bus.Send(new Pay { OrderId = orderId, Amount = 10m }); Console.ReadLine(); }
private static async Task OrderAPizza(Bus bus) { Console.WriteLine("What's the customer's name?"); var customerName = Console.ReadLine().Trim(); if (string.IsNullOrWhiteSpace(customerName)) { Console.WriteLine("You need to enter a customer name."); return; } var command = new OrderPizzaCommand {CustomerName = customerName}; await bus.Send(command); Console.WriteLine("Pizza ordered for {0}", customerName); }
public void CreateTimeAndMaterialJobOrder(CreateTimeAndMaterialViewModel model) { var command = new RegisterTimeAndMaterialJobOrderCommand( model.Customer.OriginalId, model.Customer.Name, model.Manager.OriginalId, model.Manager.Name, model.Value.Amount, model.Value.Currency, model.DateOfStart, model.DateOfExpiration, model.Name, model.PurchaseOrderNumber, model.Description ); Bus.Send(command); }
public void CreateJobOrder(CreateJobOrderViewModel model) { var command = new RegisterJobOrderCommand( model.Customer.OriginalId, model.Customer.Name, model.Manager.OriginalId, model.Price.Amount, model.Price.Currency, model.DateOfStart, model.DueDate, model.IsTimeAndMaterial, model.Name, model.PurchaseOrderNumber, model.Description ); Bus.Send(command); }
public void MarkAsComplete(Guid taskId) { var currentUserId = GetCurrentUserId(); var taskBelongsToRequestingUser = Database.Tasks.OfUser(currentUserId).Current().Any(t => t.Id == taskId); if (!taskBelongsToRequestingUser) { throw new InvalidOperationException("The specified task does not belong to current user."); } var cmd = new MarkTaskAsCompletedCommand() { TaskId = taskId, UserId = GetCurrentUserId() }; Bus.Send(cmd); }
public IHttpActionResult Get() { var cmd = new RegisterCustomerCommand() { FirstName = "Foo", LastName = "Bar", Email = "*****@*****.**" }; var result = Bus.Send(cmd); if (!result.IsSuccess) { return(BadRequest(result)); } return(Ok()); }
private static async Task OrderAPizza(Bus bus) { Console.WriteLine("What's the customer's name?"); var customerName = Console.ReadLine().Trim(); if (string.IsNullOrWhiteSpace(customerName)) { Console.WriteLine("You need to enter a customer name."); return; } var command = new OrderPizzaCommand { CustomerName = customerName }; await bus.Send(command); Console.WriteLine("Pizza ordered for {0}", customerName); }
public void Handle(ForwardMessage message) { _log.WarnFormat("Handled ForwardMessage, AccountId={0}, SagaId={1}", message.AccountId, Data.Id); var doSomethingCommand = new DoSomethingCommand { SagaId = Data.Id }; _log.WarnFormat("Sending DoSomethingCommand, SagaId={0}", doSomethingCommand.SagaId); Bus.Send(doSomethingCommand); var doSomethingElseCommand = new DoSomethingElseCommand { SagaId = Data.Id }; _log.WarnFormat("Sending DoSomethingElseCommand, SagaId={0}", doSomethingElseCommand.SagaId); Bus.Send(doSomethingElseCommand); }
public ActionResult ForgotPassword(ForgotPasswordInput forgotPasswordInput) { if (ModelState.IsValid) { var message = new ForgotPasswordInputMessage { Input = forgotPasswordInput, Result = new ForgotPasswordResult() }; Bus.Send(message); if (message.Result.Success) { return(View("forgotpasswordsent", (object)message.Result.Message)); } ModelState.AddModelError("model", message.Result.Message); } return(View(forgotPasswordInput)); }
public async Task send_via_the_alias_and_messages_actually_get_there_2() { var tracker = new MessageTracker(); with(_ => { _.Services.AddSingleton(tracker); _.Services.For <IUriLookup>().Use <FakeUriLookup>(); _.Transports.ListenForMessagesFrom("fake://one"); }); var waiter = tracker.WaitFor <Message1>(); await Bus.Send("fake://one".ToUri(), new Message1()); var envelope = await waiter; envelope.Destination.ShouldBe("loopback://one".ToUri()); }
private async void ShowVoronoiDiagram_Click(object sender, RoutedEventArgs e) { var points = this.viewModel.DrawnFeatures.Select(p => new Diagrams.Point(p.X, p.Y)).ToList(); var features = this.viewModel.DrawnCategories .Select(c => new KeyValuePair <Brush, List <Diagrams.Point> >(c.Brush, c.Features.Select(f => new Diagrams.Point(f.X, f.Y)).ToList())) .ToDictionary(k => k.Key, v => v.Value); var edges = await Bus.Query(new CalculateVoronoiEdges(points, this.Surface.ActualWidth, this.Surface.ActualHeight)); var host = await Bus.Query(new CreateShapesContainer(this.Surface.ActualWidth, this.Surface.ActualHeight)); await Bus.Send(new DrawPoints(features, host as IShapeComposite)); await Bus.Send(new DrawEdges(edges, host as IShapeComposite)); this.Surface.Children.Clear(); this.Surface.Children.Add(host); }
/// <summary> /// Sends the response. /// </summary> /// <param name="info">The information.</param> /// <param name="cmd">The command.</param> /// <param name="beforeReply">The before reply action.</param> protected void SendReply(InfoAccumulator info, CommandBase cmd, Action <T> beforeReply = null) { var response = CreateResponse <T>(info, cmd.MessageId); if (beforeReply != null) { beforeReply(response); } foreach (var header in cmd.EzBobHeaders) { response.EzBobHeaders.Add(header); } // ************** The line below does not work when using async handler ********** // Bus.Send(Bus.CurrentMessageContext.ReplyToAddress, response); //look at 'AsyncHandlerSupport' Bus.Send(cmd.ReplyToAddress, response); // Bus.Reply(response); }
static void SendThirtyRequests(Object stateInfo) { for (var i = 0; i < 30; i++) { var guid = Guid.NewGuid(); Bus.Send("IronTester.Server", Bus.CreateInstance <PleaseDoTests>(y => { y.RequestId = guid; y.SourceCodeLocation = GetRandomSourcePath(); y.TestsRequested = new List <string> { GetRandomTest(), GetRandomTest(), GetRandomTest() }; })); Thread.Sleep(1000); } }
public async Task then_a_product_is_created() { // arrange var itemId = Guid.NewGuid(); // act await Bus.Send(new CreateInventoryItem( itemId, "Foo" )); await Bus.Flush(); // assert Products.Single().Should().BeEquivalentTo( new { Id = itemId, Name = "Foo", IsActive = true }); }
public ActionResult Index(LoginInput loginInput) { if (ModelState.IsValid) { var message = new LoginInputMessage { Input = loginInput, Result = new LoginResult() }; Bus.Send(message); if (message.Result.Success) { FormsAuthentication.RedirectFromLoginPage(loginInput.Username, false); } ModelState.AddModelError("model", message.Result.Message); } return(View(loginInput)); }
public void Handle(ProcessOrderCommand message) { Console.WriteLine(); Console.WriteLine("1) Saga: sending order {0} to Sales ...", message.OrderId); Data.OrderId = message.OrderId; Data.Article = message.Article; Data.Description = message.Description; Data.Count = message.Count; Data.Price = message.Total; Data.Address = "Fernkorngasse, 1100 Wien"; Bus.Send( new AcceptOrderCommand { OrderId = Data.OrderId, Status = OrderStatus.Started }); }
static void Main(string[] args) { var message = new DummyMessage { Text = "Hello from Tuc Tuc!" }; string queue = Path.Combine(Path.GetTempPath(), "TucTuc"); var bus = new Bus(queue); bus.RegisterEndpoint<DummyMessage>(queue); bus.RegisterMessageHandler<DummyMessage>(m => Handle(m)); bus.Start(); while(true) { bus.Send(message); Thread.Sleep(60000); } }
public void Start() { Console.WriteLine("Press 's' to send a valid message, press 'e' to send a failed message. To exit, 'q'\n"); string cmd; while ((cmd = Console.ReadKey().Key.ToString().ToLower()) != "q") { switch (cmd) { case "s": Bus.Send <CreateProductCommand>(m => { m.ProductId = "XJ128"; m.ProductName = "Milk"; m.ListPrice = 4; m.SellEndDate = new DateTime(2012, 1, 3); // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed // before it reaches MSMQ. m.Image = new byte[1024 * 1024 * 7]; }); break; case "e": try { Bus.Send <CreateProductCommand>(m => { m.ProductId = "XJ128"; m.ProductName = "Milk Milk Milk Milk Milk"; m.ListPrice = 15; m.SellEndDate = new DateTime(2011, 1, 3); // 7MB. MSMQ should throw an exception, but it will not since the buffer will be compressed // before it reaches MSMQ. m.Image = new byte[1024 * 1024 * 7]; }); } //Just to allow the sample to keep running. catch { } break; } } }
public void Handle(CreateMemberRequest message) { if (string.IsNullOrWhiteSpace(message.Member.Email?.Address)) { Bus.Publish(new MemberUpdatedEvent().LinkTo(message) .WithProcessResult(new ArgumentException("Email address is required"), "Email address is required.")); MarkAsComplete(); } Data.Email = message.Member.Email?.Address; DataCache.SetItem(message, Data.Email); var createUserRequest = new CreateUserRequest { UserUpdate = MappingService.Map <UserUpdateDto>(message.Member) }.LinkTo(message); Bus.Send(_commonBusEndpointSettings.Identity, createUserRequest); }
public AddExpenseResult Handle(AddExpenseCommand request) { var entry = new AuditEntry() { Employee = request.CurrentUser, Date = request.CurrentDate, EmployeeName = request.CurrentUser.FirstName, BeginStatus = request.Report.Status }; request.Report.AddAuditEntry(entry); request.Report.AddExpense(request.Description, request.Amount); _bus.Send(new ExpenseReportSaveCommand() { ExpenseReport = request.Report }); return(new AddExpenseResult()); }
public async Task SetCompanyContactInfoAsync(SetCompanyContactInfoModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var userId = model.UserId; var cmd = new ChangeCompanyContactInfoCommand( userId, model.CompanyId, model.PhoneNumber, model.FaxNumber, model.WebsiteAddress, model.EmailAddress); await Bus.Send(cmd); }
public void Handle(PantsHaveBeenPutOnEvent message) { Console.WriteLine("Link has put his pants on. We should prepare his quest"); _bus.Send(new KidnapPrincessCommand { SagaId = message.SagaId }); _bus.Send(new PrepareSwordCommand { SagaId = message.SagaId, NumberOfFolds = 800 }); // Check if everything is ready in time SetTimeout(DateTime.Now.AddSeconds(20)); }
public when_logging_high_volume_message_traffic(StreamStoreConnectionFixture fixture) : base(fixture.Connection) { // commands must have a commandHandler _cmdHandler = new TestCommandSubscriber(Bus); _commandFireCount = 0; _commandAckCount = 0; _commandSuccessCount = 0; _lastCommandCount = 0; _countedEventCount = 0; _testDomainEventCount = 0; _numberOfItemsLogged = 0; _catchupSubscriptionMsgs = 0; _listener = new SynchronizableStreamListener( Logging.FullStreamName, Connection, StreamNameBuilder, EventSerializer); _listener.EventStream.Subscribe <Message>(this); _listener.Start(Logging.FullStreamName); CorrelatedMessage source = CorrelatedMessage.NewRoot(); // create and fire a mixed set of commands and events for (int i = 0; i < _maxCountedMessages; i++) { var evt = new CountedEvent(i, source); Bus.Publish(evt); // this is just an example command - choice to fire this one was random var cmd = new TestCommands.Command2(evt); Bus.Send(cmd, $"exception message{i}", TimeSpan.FromSeconds(2)); var evt2 = new TestEvent(cmd); Bus.Publish(evt2); source = evt2; } var tstCmd = new TestCommands.Command3(source); Bus.Send(tstCmd, "TestCommand3 failed", TimeSpan.FromSeconds(2)); }
public void SaveMyCategories(IEnumerable <int> categoryIds) { if (categoryIds == null) { categoryIds = new List <int>(); } var newCategories = new List <short>(); using (var actionsSession = actionSessionFactory.CreateContext(true)) { var likedCategories = GetMyCategoryIds(false); foreach (var id in categoryIds) { if (!likedCategories.Contains(id) && id > 0) { var categoryLike = new Data.EF.Actions.InterestingCategory { CategoryId = (short)id, UserId = CurrentUser.DbId.Value }; actionsSession.InterestingCategories.Add(categoryLike); newCategories.Add((short)id); } } foreach (var catId in likedCategories.Except(categoryIds.Cast <int>())) { actionsSession.InterestingCategories.Delete(ic => ic.CategoryId == catId && ic.UserId == CurrentUser.DbId); } } CurrentUser.SelectedCategoryIds = null; CurrentUser.SelectedCategoryIds = GetMyCategoryIds(false); Bus.Send(new LikedCategoriesCommand { CategoryIds = newCategories, UserDbId = CurrentUser.DbId.Value }); }
public async Task <bool> RecommendAsyncDiagnosis() { var bus = new Bus(); try { var command = new Command { CorrelationId = Guid.NewGuid().ToString("D") }; bus.Send(command); var completedEvent = bus.RequestAsync <Command, CommandCompletedEvent <Command>, ErrorEvent <Exception> >(command); Console.WriteLine(completedEvent.Result.CorrelationId); } catch (ReceivedErrorEventException <ErrorEvent <Exception> > ex) { Console.WriteLine("got an error" + ex); } return(true); }
public void Timeout(ScheduleEmailTimeout state) { if (!Data.SchedulingPaused && state.TimeoutCounter == Data.TimeoutCounter) { var originalMessage = Data.OriginalMessageData; var sendOneEmailNow = new SendOneEmailNow { CorrelationId = Data.Id, BodyHtml = Data.OriginalMessageData.BodyHtml, BodyText = Data.OriginalMessageData.BodyText, FromAddress = Data.OriginalMessageData.FromAddress, FromDisplayName = Data.OriginalMessageData.FromDisplayName, ReplyToAddress = Data.OriginalMessageData.ReplyToAddress, Subject = Data.OriginalMessageData.Subject, ToAddress = Data.OriginalMessageData.ToAddress, Username = originalMessage.Username }; Bus.Send("smsactioner", sendOneEmailNow); } }
protected override async Task When() { Enumerable.Range(0, _totalCommands) .Select(i => Bus.Send(new SlowCommand())) .WaitAll(); await Task.Delay(TimeSpan.FromMilliseconds(500)); await Bus.Stop(); _commandHandlerInvocationCount = MethodCallCounter.AllReceivedMessages.OfType <SlowCommand>().Count(); Console.WriteLine("Bus has stopped."); Console.WriteLine("Number of commands received immediately afterwards: {0}", _commandHandlerInvocationCount); MethodCallCounter.Clear(); await Task.Delay(TimeSpan.FromSeconds(2)); _additionalCommandHandlerInvocationCount = MethodCallCounter.AllReceivedMessages.OfType <SlowCommand>().Count(); Console.WriteLine("Number of commands received after that: {0}", _additionalCommandHandlerInvocationCount); MethodCallCounter.Stop(); }
public void ChangeAddress(ChangeAddressViewModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var effectiveDateTime = model.EffectiveDate; var effectiveDate = new DateTime(effectiveDateTime.Year, effectiveDateTime.Month, effectiveDateTime.Day); var cmd = new ChangePersonAddressCommand(model.PersonId, model.Address.Address, model.Address.PostalCode, model.Address.City, model.Address.Province, model.Address.Country, effectiveDate); Bus.Send(cmd); }
/// <summary> /// Replies to origin. /// </summary> /// <param name="handledResponse">The handled response.</param> /// <param name="beforeReply">The before reply.</param> protected void ReplyToOrigin(CommandResponseBase handledResponse, Action <T> beforeReply = null) { T responseToSend = new T(); string replyTo = (string)handledResponse.EzBobHeaders[Headers.ReplyToAddress]; string correlatonId = (string)handledResponse.EzBobHeaders[Headers.CorrelationId]; responseToSend.MessageId = handledResponse.MessageId; responseToSend.Errors = handledResponse.Errors; responseToSend.Infos = handledResponse.Infos; responseToSend.Warnings = handledResponse.Warnings; if (beforeReply != null) { beforeReply(responseToSend); } Bus.Send(replyTo, correlatonId, responseToSend); }
public void Handle(SendAllMessagesAtOnce message) { // TODO: make a timeout for this then just send the messsages directly to the sms actioner Data.CoordinatorId = message.CoordinatorId == Guid.Empty ? Data.Id : message.CoordinatorId; Data.OriginalScheduleStartTime = message.SendTimeUtc; Data.EmailAddresses = message.ConfirmationEmails; Data.UserOlsenTimeZone = message.UserOlsenTimeZone; Data.Topic = message.MetaData.Topic; var messageList = new List <ScheduleSmsForSendingLater>(); for (int i = 0; i < message.Messages.Count; i++) { var smsData = new SmsData(message.Messages[i].Mobile, message.Messages[i].Message); var smsForSendingLater = new ScheduleSmsForSendingLater(message.SendTimeUtc, smsData, message.MetaData, Data.CoordinatorId, message.Username) { CorrelationId = Data.CoordinatorId }; messageList.Add(smsForSendingLater); } messageList.ForEach(m => Bus.Send(m)); //Bus.Send(messageList.ToArray()); var coordinatorCreated = new CoordinatorCreated { CoordinatorId = Data.CoordinatorId, ScheduledMessages = messageList.Select(m => new MessageSchedule { Number = m.SmsData.Mobile, ScheduledTimeUtc = m.SendMessageAtUtc, ScheduleMessageId = m.ScheduleMessageId }).ToList(), CreationDateUtc = DateTime.UtcNow, MetaData = message.MetaData, ConfirmationEmailAddresses = message.ConfirmationEmails, UserOlsenTimeZone = message.UserOlsenTimeZone, MessageBody = message.Messages.First().Message, MessageCount = message.Messages.Count }; RequestUtcTimeout <CoordinatorTimeout>(message.SendTimeUtc.AddMinutes(2)); Bus.Publish(coordinatorCreated); Bus.SendLocal(new CoordinatorCreatedEmail(coordinatorCreated)); RavenScheduleDocuments.SaveCoordinator(coordinatorCreated); RavenScheduleDocuments.SaveSchedules(messageList, Data.CoordinatorId); }
public async Task ChangeContactInfoAsync(Guid personId, ChangeContactInfoModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var userId = GetCurrentUserId(); var cmd = new ChangePersonContactInfoCommand( userId, personId, model.PhoneNumber, model.MobileNumber, model.FaxNumber, model.WebsiteAddress, model.EmailAddress, model.InstantMessaging); await Bus.Send(cmd); }
public async Task CreateJobOrderAsync(CreateModel model) { var userId = GetCurrentUserId(); var command = new RegisterJobOrderCommand( userId, model.Customer.OriginalId, model.Customer.Name, model.ContactPerson.OriginalId, model.Manager.OriginalId, model.Price.Amount, model.Price.Currency, model.DateOfStart, model.DueDate, model.IsTimeAndMaterial, model.Name, model.PurchaseOrderNumber, model.Description ); await Bus.Send(command); }
public void SentFail(PendingMessage pending, string status, string message = null) { var sentFail = new SentFail(); sentFail.Stack = status; sentFail.Message = message; sentFail.MessageId = pending.MessageId; sentFail.Recipients = pending.Recipients; sentFail.Subject = pending.Subject; var contentString = Newtonsoft.Json.JsonConvert.SerializeObject(sentFail); var path = System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location); path = System.IO.Path.Combine(path, $"fails/{status.Replace("sendinblue:", "")}-{Guid.NewGuid()}.json"); System.IO.File.WriteAllText(path, contentString); var failQueueName = GlobalConfiguration.Configuration.SentFailQueueName; Bus.Send(failQueueName, sentFail); }
public void Should_throw_when_write_queues_are_undefined() { var emptyWriteQueueList = new FakeValidMessageQueue[] { }; var bus = new Bus(new BusConfig(), new NullLogger(), new FakeValidMessageQueue(), new FakeValidMessageQueue(), emptyWriteQueueList); var exception = Assert.Throws<BusException>(() => bus.Send(new FakeDto())); Assert.That(exception.Message, Is.EqualTo("Bus has not been configured for sending messages. Did you forget to call DefineWriteQueue on BusBuilder?")); }
public void Should_place_on_next_write_queue_if_auto_distribute_configured() { var msg = new FakeDto(); var writeQueues = new[] { new FakeValidMessageQueue(), new FakeValidMessageQueue(), new FakeValidMessageQueue() }; var bus = new Bus(new FakeBusConfig { AutoDistributeOnSend = true }, new NullLogger(), new FakeValidMessageQueue(), new FakeValidMessageQueue(), writeQueues); bus.Send(msg); Assert.That(writeQueues[0].Count, Is.EqualTo(1)); Assert.That(writeQueues[1].Count, Is.EqualTo(0)); Assert.That(writeQueues[2].Count, Is.EqualTo(0)); bus.Send(msg); Assert.That(writeQueues[0].Count, Is.EqualTo(1)); Assert.That(writeQueues[1].Count, Is.EqualTo(1)); Assert.That(writeQueues[2].Count, Is.EqualTo(0)); bus.Send(msg); Assert.That(writeQueues[0].Count, Is.EqualTo(1)); Assert.That(writeQueues[1].Count, Is.EqualTo(1)); Assert.That(writeQueues[2].Count, Is.EqualTo(1)); }
public void Should_place_on_a_single_queue() { var msg = new FakeDto(); var writeQueues = new[] { new FakeValidMessageQueue() }; var bus = new Bus(new FakeBusConfig(), new NullLogger(), new FakeValidMessageQueue(), new FakeValidMessageQueue(), writeQueues); bus.Send(msg); Assert.That(writeQueues[0].Count, Is.EqualTo(1)); }
public void Should_log_all_steps_involved() { var logger = new FakeLogger(); var msg = new FakeDto(); var writeQueues = new[] { new FakeValidMessageQueue() }; var bus = new Bus(new FakeBusConfig(), logger, new FakeValidMessageQueue(), new FakeValidMessageQueue(), writeQueues); bus.Send(msg); Assert.That(logger[0], Is.StringEnding("Transaction started")); Assert.That(logger[1], Is.StringEnding("Started SEND Operation")); Assert.That(logger[2], Is.StringEnding("Payload: FakeDto")); Assert.That(logger[3], Is.StringEnding("Sent to queue: FakeValidMessageQueue")); Assert.That(logger[4], Is.StringEnding("Completed SEND Operation")); Assert.That(logger[5], Is.StringEnding("Transaction committed")); }