예제 #1
0
        public void ShouldParseViewResultInfoProperties()
        {
            IViewQueryResult viewResult;

            using (TextReader stringReader = new StringReader(TestData))
                viewResult = ViewQueryResultParser.Parse(stringReader, new ViewQuery());

            Assert.Equal(42, viewResult.TotalCount);
            Assert.Equal(3, viewResult.Count);
            Assert.Equal(1, viewResult.Offset);
        }
예제 #2
0
        public void ShouldParseViewResultInfoRows()
        {
            IViewQueryResult viewResult;

            using (TextReader stringReader = new StringReader(TestData))
                viewResult = ViewQueryResultParser.Parse(stringReader, new ViewQuery());

            ViewResultRow secondRow = viewResult.Rows.Skip(1).First();

            Assert.Equal("c615149e5ac83b40b9ad20914d00011d", secondRow.DocumentId);
            Assert.Equal("c615149e5ac83b40b9ad20914d00011d-42".ToJsonFragment(), secondRow.Key);
            TestUtils.AssertSameJson(new { rev = "1-5af52f56d6ca7a6d600f2d9f4c2c7489" }, secondRow.Value);
            Assert.Equal(
                new {
                _id          = "c615149e5ac83b40b9ad20914d00011d",
                _rev         = "1-5af52f56d6ca7a6d600f2d9f4c2c7489",
                eventType    = "ViewerDisconnected",
                type         = "liveVideoEvent",
                viewersCount = 1
            }.ToDocument(),
                secondRow.Document);
        }
예제 #3
0
 public void ShouldThrowParseExceptionOnInvalidJson(string json)
 {
     using (TextReader stringReader = new StringReader(json))
         Assert.Throws <ParseException>(() => ViewQueryResultParser.Parse(stringReader, new ViewQuery()));
 }