public async Task <SimpleMessageResponse> CreateSimpleMessageResponse(SimpleMessageParam request)
        {
            _logger.LogInformation($"Сообщение получено из очереди в { DateTimeOffset.Now }");
            var response = new SimpleMessageResponse
            {
                ResponseText = "Responding to " + request.Text,
                Timespam     = DateTimeOffset.Now - request.CreateTimestamp
            };

            return(await Task.FromResult(response));
        }
Esempio n. 2
0
        public async Task ReturnsNotFoundGivenNoRemainingItems()
        {
            //Arrange
            var request      = new SimpleMessageParam("test");
            var mockResponse = new SimpleMessageResponse
            {
                Timespam     = new TimeSpan(1000),
                ResponseText = "test"
            };

            _rpc.RequestAsync <SimpleMessageParam, SimpleMessageResponse>(Arg.Any <SimpleMessageParam>(), Arg.Any <CancellationToken>()).Returns(mockResponse);
            var service = new RequestService(_rpc, _logger);

            //Act
            var result = await service.SimpleMessageRequest(request, CancellationToken.None);

            //Assert
            Assert.Equal("test", result.ResponseText);
            Assert.Equal(new TimeSpan(1000), result.Timespam);
        }
 public async Task <SimpleMessageResponse> SimpleMessageRequest(SimpleMessageParam request, CancellationToken cancellationToken)
 {
     request.CreateTimestamp = DateTimeOffset.Now;
     _logger.LogInformation($"Сообщение отправлено в очередь в { DateTimeOffset.Now }");
     return(await _rpc.RequestAsync <SimpleMessageParam, SimpleMessageResponse>(request, cancellationToken));
 }
Esempio n. 4
0
 private Task OnSimpleMessageHandler(SimpleMessageParam arg1, CancellationToken arg2) => throw new NotImplementedException();