Ejemplo n.º 1
0
 public IEnumerable <Animal> GetAnimals(GetAnimalsCommand command)
 {
     return(new []
     {
         new Animal
         {
             Name = "Jeffrey",
             Species = "Cat"
         },
         new Animal
         {
             Name = "Jonas",
             Species = "Elephant"
         }
     });
 }
Ejemplo n.º 2
0
        public void UseConventionsRegistersProperCommandListeners()
        {
            // Arrange
            var testContext = new TestBusContext();
            var hostBuilder = new MicroserviceHostBuilder()
                              .WithBusContext(testContext);

            // Act
            hostBuilder.UseConventions();

            hostBuilder.CreateHost().Start();

            // Assert
            var message = new GetAnimalsCommand();

            ICommandPublisher publisher = new CommandPublisher(testContext);

            Animal[] animals = publisher.PublishAsync <IEnumerable <Animal> >(message).Result.ToArray();
            Assert.AreEqual(2, animals.Length);
        }