public void CountMaterializerThrowsForNegativeCount() { var response = new ElasticResponse { hits = new Hits { hits = new List<Hit>(), total = -1 } }; var materializer = new CountElasticMaterializer(typeof(int)); Assert.Throws<ArgumentOutOfRangeException>(() => materializer.Materialize(response)); }
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(typeof(long)); var actual = materializer.Materialize(response); Assert.Equal(expected, actual); }
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(); var actual = materializer.Materialize(response); Assert.Equal(expected, actual); }