public async Task GetVerseHtml_When_valid_single_verse_Then_returns_html(string verse, string expectedText)
        {
            // ARRANGE
            var verseRetriever = GetVerseRetriever();

            _verseParser.TryParseVerseString(verse, "en", out VerseSetDescriptor verseSet);

            // ACT
            var html = await verseRetriever.GetVerseHtmlAsync(verseSet, ENGLISH);

            // ASSERT
            html.ShouldNotBeNull();

            html.ShouldContain(expectedText);
        }
Exemplo n.º 2
0
        public async Task GetSearchCountAsync_When_valid_verse_set_Then_returns_count(string verse, int expectedMin, int expectedMax)
        {
            // ARRANGE
            var searchCountRetriever = GetSearchCountRetriever();

            _verseParser.TryParseVerseString(verse, "en", out VerseSetDescriptor verseSet);

            // ACT
            var count = await searchCountRetriever.GetSearchCountAsync(verseSet);

            // ASSERT
            count.ShouldNotBeNull();

            count.Value.ShouldBeGreaterThanOrEqualTo(expectedMin);

            count.Value.ShouldBeLessThanOrEqualTo(expectedMax);
        }
        public async Task GetVerseHtml_When_language_spanish_Then_returns_expected_html(string verse, string expectedText)
        {
            // ARRANGE
            _bibleBookProviderMock = new BibleBookProviderMock();
            _verseParser           = new VerseParser(_bibleBookProviderMock.Object);

            var verseRetriever = GetVerseRetriever();

            _verseParser.TryParseVerseString(verse, SPANISH, out VerseSetDescriptor verseSet);

            // ACT
            var html = await verseRetriever.GetVerseHtmlAsync(verseSet, SPANISH);

            // ASSERT
            html.ShouldNotBeNull();

            html.ShouldContain(expectedText);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> LookupScripture(string language, string verse)
        {
            string html = null;

            switch (_verseParser.TryParseVerseString(verse, language, out VerseSetDescriptor verseSet))
            {
            case VerseParseResult.Success:

                html = await _scriptureLookupManager.GetVerseHtmlFromSetCode(verseSet.Code, language);

                break;

            case VerseParseResult.InvalidVerse:
                html = "The verse could not be found.";
                break;

            case VerseParseResult.InvalidSyntax:
                html = "Invalid syntax. Try again.";
                break;
            }

            return(Json(html));
        }