Exemple #1
0
        public void ItDefaultsToGetForShortQueries()
        {
            RegisterSelectQueryGetHandler();
            var endpoint = GetQueryEndpoint();
            var results  = endpoint.QueryWithResultSet("SELECT * WHERE {?s ?p ?o}");

            results.Should().NotBeNull().And.HaveCount(1);
            var sparqlLogEntries = _server.FindLogEntries(new RequestMessagePathMatcher(MatchBehaviour.AcceptOnMatch, "/sparql")).ToList();

            sparqlLogEntries.Should().HaveCount(1);
            sparqlLogEntries[0].RequestMessage.Method.Should().BeEquivalentTo("get");
        }
        public void ItCallsServiceWithoutInlineData()
        {
            var dataset = CreateDataset(numberOfTriples: 0);
            var query   = $"SELECT * WHERE {{ SERVICE <{ServiceUri}> {{?s ?p ?o}} }}";
            var expectedServiceQuery = "SELECT * WHERE { ?s ?p ?o }";
            var serviceResults       = XmlFormat(CreateResults(1));

            RegisterSelectQueryGetHandler(SameAsQuery(expectedServiceQuery), serviceResults);

            var results = ProcessQuery(dataset, query);

            results.Should().NotBeNull().And.HaveCount(1);
            var sparqlLogEntries = _server.FindLogEntries(new RequestMessagePathMatcher(MatchBehaviour.AcceptOnMatch, "/sparql")).ToList();

            sparqlLogEntries.Should().HaveCount(1);
            sparqlLogEntries[0].RequestMessage.Method.Should().BeEquivalentTo("get");
        }
Exemple #3
0
        public void WordSmithTest2()
        {
            var nounIsRequested      = RequestIsSentTo("/words/noun");
            var verbIsRequested      = RequestIsSentTo("/words/verb");
            var adjectiveIsRequested = RequestIsSentTo("/words/adjective");

            When(nounIsRequested).RespondWith(WordResponse("dummy-noun"));
            When(verbIsRequested).RespondWith(WordResponse("dummy-verb"));
            When(adjectiveIsRequested).RespondWith(WordResponse("dummy-adjective"));

            _driver.Url = Url;
            Wait.Until(() => "Dummy-adjective" == _driver.FindElement(By.CssSelector(".line1 .adjective .word")).Text, 2.Seconds(), "First word");
            Assert.AreEqual("dummy-noun", _driver.FindElement(By.CssSelector(".line1 .noun .word")).Text);
            Assert.AreEqual("dummy-verb", _driver.FindElement(By.CssSelector(".line2 .verb .word")).Text);
            Assert.AreEqual("dummy-adjective", _driver.FindElement(By.CssSelector(".line3 .adjective .word")).Text);
            Assert.AreEqual("dummy-noun", _driver.FindElement(By.CssSelector(".line3 .noun .word")).Text);

            Assert.AreEqual(2, _server.FindLogEntries(nounIsRequested).Count(), "nouns");
            Assert.AreEqual(1, _server.FindLogEntries(verbIsRequested).Count(), "verbs");
            Assert.AreEqual(2, _server.FindLogEntries(adjectiveIsRequested).Count(), "adjectives");
        }
Exemple #4
0
        public async Task Sets_given_cryptocurrency_code_in_URL_of_get_latest_cryptocurrency_quotes_requests()
        {
            ConfigureGetLatestCryptocurrencyQuotesRequestsToRespondSuccessfully();

            await _exchangeRatesService.GetQuotesFor(CurrencyCode.Of(BTC));

            var foundRequests = _mockServer.FindLogEntries(
                Request.Create()
                .WithPath(GetLatestCryptocurrencyQuotesRequestUrlPath)
                .WithParam(BaseCryptocurrencyCodeParameterName, BTC)
                .UsingGet());

            foundRequests.Should().HaveCount(5);
        }