コード例 #1
0
        public async Task ShouldPass()
        {
            var handler = new PingHandler();
            var request = new PingRequest {
                Message = "Hello World"
            };
            var response = await handler.Handle(request, CancellationToken.None);

            response.Message.Should().Be("Hello World");
        }
コード例 #2
0
        public async Task Should_call_abstract_handler()
        {
            IRequestHandler <Ping, Pong> handler = new PingHandler();

            var response = await handler.Handle(new Ping()
            {
                Message = "Ping"
            }, default);

            response.Message.ShouldBe("Ping Pong");
        }
コード例 #3
0
        public async Task Should_Call_Abstract_Handler()
        {
            // Arrange
            IRequestHandler <Ping, Pong> requestHandler = new PingHandler();
            var expected = "Ping Pong";

            // Act
            var response = await requestHandler.Handle(new Ping()
            {
                Message = "Ping"
            }, default(CancellationToken));

            // Assert
            Assert.AreEqual(expected, response.Message);
        }
コード例 #4
0
    public async Task Should_call_abstract_unit_handler()
    {
        var builder = new StringBuilder();
        var writer  = new StringWriter(builder);

        IRequestHandler <Ping, Unit> handler = new PingHandler(writer);

        await handler.Handle(new Ping()
        {
            Message = "Ping"
        }, default);

        var result = builder.ToString();

        result.ShouldContain("Ping Pong");
    }