public async Task ShouldReturnOriginalStringWhenHttpRequestExceptionIsRaised()
        {
            var mockHandler = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            mockHandler
            .Protected()
            // Setup the PROTECTED method to mock
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            // prepare the expected response of the mocked http call
            .Throws <HttpRequestException>()
            //.ReturnsAsync(new HttpResponseMessage(HttpStatusCode.NotFound))
            .Verifiable();

            var client = new HttpClient(mockHandler.Object)
            {
                BaseAddress = new Uri(TranslationServiceUri)
            };

            _shakespeareTranslationService = new ShakespeareTranslationService(client);

            var result = await _shakespeareTranslationService.Translate(TextToTranslate);

            Assert.IsTrue(string.Equals(result, TextToTranslate));
        }
        public async Task ShouldGetShakespeareTranslation()
        {
            var mockHandler = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            mockHandler
            .Protected()
            // Setup the PROTECTED method to mock
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            // prepare the expected response of the mocked http call
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("{'success':{'total':1},'contents':{'translated':'Thee did giveth mr. Tim a hearty meal,  but unfortunately what he did doth englut did maketh him kicketh the bucket.','text':'You gave Mr. Tim a hearty meal, but unfortunately what he ate made him die.','translation':'shakespeare'}}"),
            })
            .Verifiable();

            var client = new HttpClient(mockHandler.Object)
            {
                BaseAddress = new Uri(TranslationServiceUri)
            };

            _shakespeareTranslationService = new ShakespeareTranslationService(client);

            var result = await _shakespeareTranslationService.Translate(TextToTranslate);

            Assert.IsTrue(string.Equals(result, TranslatedText));
        }
        public async void Translate_ValidText_ShouldReturnTranslatedText(string text, string expectedTranslatedText)
        {
            var service = new ShakespeareTranslationService();

            var translatedText = await service.Translate(text);

            translatedText.Should().Be(expectedTranslatedText);
        }
        public void Translate_InvalidText_ShouldThrownArgumentExcpetion(string text)
        {
            var service = new ShakespeareTranslationService();

            Func <Task <string> > func = async() => await service.Translate(text);

            func.Should().Throw <ArgumentException>();
        }