public void Test_IsValued_ByName() { var mockBucket = new Mock <IBucket>(); mockBucket.SetupGet(e => e.Name).Returns("default"); var query = QueryFactory.Queryable <Contact>(mockBucket.Object) .Where(p => N1Ql.IsValued(p, "test")); const string expected = "SELECT `Extent1`.* FROM `default` as `Extent1` WHERE `Extent1`.`test` IS VALUED"; var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression); Assert.AreEqual(expected, n1QlQuery); }
public void AggregateTests_SimpleAverage() { using (var cluster = new Cluster(TestConfigurations.DefaultConfig())) { using (var bucket = cluster.OpenBucket("beer-sample")) { var avg = bucket.Queryable <Beer>().Where(p => p.Type == "beer" && N1Ql.IsValued(p.Abv)).Average(p => p.Abv); Console.WriteLine("Average ABV of all beers is {0}", avg); } } }