Exemplo n.º 1
0
        public void ParseFacetRangeResultsWithOther()
        {
            var xml     = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.partialResponseWithRangeFacetAndOther.xml");
            var p       = new FacetsResponseParser <Product>();
            var results = p.ParseFacetRanges(xml.Root);

            Assert.Equal(1, results.Count);
            var result = results.First();

            Assert.Equal("timestamp", result.Key);
            Assert.Equal("+1DAY", result.Value.Gap);
            Assert.Equal("2017-08-29T00:00:00Z", result.Value.Start);
            Assert.Equal("2017-08-31T00:00:00Z", result.Value.End);
            var RangeResults = result.Value.RangeResults;

            Assert.Equal(2, RangeResults.Count);
            Assert.Equal(27, RangeResults[0].Value);
            Assert.Equal("2017-08-29T00:00:00Z", RangeResults[0].Key);
            Assert.Equal(124, RangeResults[1].Value);
            Assert.Equal("2017-08-30T00:00:00Z", RangeResults[1].Key);

            var other = result.Value.OtherResults;

            Assert.Equal(41739753, other[FacetRangeOther.Before]);
            Assert.Equal(47567, other[FacetRangeOther.After]);
            Assert.Equal(151, other[FacetRangeOther.Between]);
        }
Exemplo n.º 2
0
        public void ParseFacetRangeResults()
        {
            var xml     = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.partialResponseWithRangeFacet.xml");
            var p       = new FacetsResponseParser <Product>();
            var results = p.ParseFacetRanges(xml.Root);

            Assert.Equal(1, results.Count);
            var result = results.First();

            Assert.Equal("timestamp", result.Key);
            Assert.Equal("+1DAY", result.Value.Gap);
            Assert.Equal("2017-08-29T00:00:00Z", result.Value.Start);
            Assert.Equal("2017-08-31T00:00:00Z", result.Value.End);
            var RangeResults = result.Value.RangeResults;

            Assert.Equal(2, RangeResults.Count);
            Assert.Equal(27, RangeResults[0].Value);
            Assert.Equal("2017-08-29T00:00:00Z", RangeResults[0].Key);
            Assert.Equal(124, RangeResults[1].Value);
            Assert.Equal("2017-08-30T00:00:00Z", RangeResults[1].Key);
        }