예제 #1
0
        public Task CommandResult_NotRequired()
        {
            return(CommandConsumer.Test(
                       async c =>
            {
                c.Build();

                var domainEventSrv = c.Services.Resolve <IMessagingService>();
                var evt = new MockCommandNoResult();
                await domainEventSrv.PublishAsync(evt);
            },
                       (IAppContainer c) =>
            {
                var consumer = c.Services.Resolve <MockCommandConsumer>();
                consumer.ExecutedHandlers.Should().HaveCount(1);
                consumer.ExecutedHandlers.Should().Contain("OnCommandNoResult");
            }));
        }
예제 #2
0
        public Task CommandResult_NotRequired()
        {
            return(ContainerFixture.TestAsync(async fixture =>
            {
                var testResult = await fixture.Arrange
                                 .Container(c => c.WithHostCommandConsumer())
                                 .Act.OnServices(async s =>
                {
                    var messagingSrv = s.GetService <IMessagingService>();
                    var cmd = new MockCommandNoResult();

                    await messagingSrv.SendAsync(cmd);
                });

                testResult.Assert.Services(s =>
                {
                    var consumer = s.GetRequiredService <MockCommandConsumer>();
                    consumer.ExecutedHandlers.Should().HaveCount(1);
                    consumer.ExecutedHandlers.Should().Contain("OnCommandNoResult");
                });
            }));
        }
 public Task OnCommandNoResult(MockCommandNoResult command)
 {
     AddCalledHandler(nameof(OnCommandNoResult));
     return(Task.Run(() => { }));
 }