public void ShouldParseViewResultInfoProperties() { ILuceneQueryResult viewResult; using (TextReader stringReader = new StringReader(TestData)) viewResult = LuceneQueryResultParser.Parse(stringReader, new LuceneQuery()); Assert.Equal(42, viewResult.TotalCount); Assert.Equal(3, viewResult.Count); Assert.Equal(1, viewResult.Offset); Assert.Equal(1, viewResult.Skip); Assert.Equal(3, viewResult.Limit); Assert.Equal(TimeSpan.FromMilliseconds(4), viewResult.FetchDuration); Assert.Equal(TimeSpan.FromMilliseconds(518), viewResult.SearchDuration); }
public void ShouldParseViewResultInfoRows() { ILuceneQueryResult viewResult; using (TextReader stringReader = new StringReader(TestData)) viewResult = LuceneQueryResultParser.Parse(stringReader, new LuceneQuery()); LuceneResultRow secondRow = viewResult.Rows.Skip(1).First(); Assert.Equal("c615149e5ac83b40b9ad20914d00011d", secondRow.DocumentId); Assert.Equal(0.1m, secondRow.Score); TestUtils.AssertSameJson(new { three = 3, four = "four" }, secondRow.Fields); Assert.Equal("c615149e5ac83b40b9ad20914d00011d", secondRow.Id); TestUtils.AssertSameJson( new { _id = "c615149e5ac83b40b9ad20914d00011d", _rev = "1-5af52f56d6ca7a6d600f2d9f4c2c7489", eventType = "ViewerDisconnected", type = "liveVideoEvent", viewersCount = 1 }, secondRow.Document.RawJsonObject); }
public void ShouldThrowParseExceptionOnInvalidResponse(string json) { using (TextReader stringReader = new StringReader(json)) Assert.Throws <ParseException>(() => LuceneQueryResultParser.Parse(stringReader, new LuceneQuery())); }