Пример #1
0
        public void CountMaterializerThrowsForNegativeCount()
        {
            var response = new ElasticResponse {
                hits = new Hits {
                    hits = new List <Hit>(), total = -1
                }
            };
            var materializer = new CountElasticMaterializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => materializer.Materialize(response));
        }
Пример #2
0
        public void CountMaterializerReturnsZeroCount()
        {
            const int expected = 0;
            var       response = new ElasticResponse {
                hits = new Hits {
                    hits = new List <Hit>(), total = expected
                }
            };
            var materializer = new CountElasticMaterializer();

            var actual = materializer.Materialize(response);

            Assert.Equal(expected, actual);
        }
Пример #3
0
        public void CountMaterializerReturnsLongCount()
        {
            const long expected = ((long)int.MaxValue) + 1;
            var        response = new ElasticResponse {
                hits = new Hits {
                    hits = new List <Hit>(), total = expected
                }
            };
            var materializer = new CountElasticMaterializer();

            var actual = materializer.Materialize(response);

            Assert.Equal(expected, actual);
        }
Пример #4
0
        public void CountMaterializerReturnsIntCount()
        {
            const int expected = int.MaxValue;
            var       response = new ElasticResponse {
                hits = new Hits {
                    hits = new List <Hit>(), total = expected
                }
            };
            var materializer = new CountElasticMaterializer(typeof(int));

            var actual = materializer.Materialize(response);

            Assert.Equal(expected, actual);
        }