public ActionResult Add(PostNewTweetCommand command) { var service = new Commanding.SimpleTwitterCommandServiceClient(); service.Execute(command); return RedirectToAction("Index"); }
public void then_the_command_handler_will_receive_the_message_and_publish_a_tweet_posted_event() { var command = new PostNewTweetCommand() {Message = "Hello!", Who = "me"}; MessageBus.Publish(command); // make sure that the command reaches the command consumer: var newTweetCommand = (from message in PublishedMessages where message.GetType() == typeof(PostNewTweetCommand) select message).FirstOrDefault(); Assert.NotNull(newTweetCommand); // make sure that the "tweet posted" event is sent when a new tweet is created: var tweetPostedEvent = (from message in PublishedMessages where message.GetType() == typeof (TweetPostedEvent) select message).FirstOrDefault(); Assert.NotNull(tweetPostedEvent); }
public void Execute(PostNewTweetCommand command) { var service = NcqrsEnvironment.Get<ICommandService>(); service.Execute(command); }