Example #1
0
        public void FireAndForgetErrorAddsMessageToStore()
        {
            var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory);

            mapper.HandleFireAndForgetError(new ArgumentException("something went wrong for testing purpose"), "testCorrelationId");
            var result        = mapper.GetMessageByCorrelationId("testCorrelationId");
            var errorResponse = JsonConvert.DeserializeObject <Response <Error> >(result);

            Assert.Equal(typeof(ArgumentException).Name, errorResponse.Content.ExceptionType);
        }
Example #2
0
        public void MessageStoreReturnsErrorIfCorrelationKeyIsNotFound()
        {
            var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory);

            var result        = mapper.GetMessageByCorrelationId("testCorrelationId");
            var errorResponse = JsonConvert.DeserializeObject <Response <Error> >(result);

            Assert.Equal(typeof(KeyNotFoundException).Name, errorResponse.Content.ExceptionType);
            Assert.Equal("testCorrelationId", errorResponse.CorrelationKey);
        }
Example #3
0
        public void FireAndForgetSuccessAddsMessageToStore()
        {
            var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory);

            mapper.HandleFireAndForgetSuccess("successTest", "testCorrelationId");
            var result          = mapper.GetMessageByCorrelationId("testCorrelationId");
            var successResponse = JsonConvert.DeserializeObject <Response <string> >(result);

            Assert.Equal("successTest", successResponse.Content);
            Assert.Equal("testCorrelationId", successResponse.CorrelationKey);
        }