public void Test_IsMissing_SubstiteWithDefault() { var mockBucket = new Mock <IBucket>(); mockBucket.SetupGet(e => e.Name).Returns("default"); var query = QueryFactory.Queryable <Contact>(mockBucket.Object) .Select(p => new { age = N1Ql.IsMissing(p.Age) ? 10 : p.Age }); const string expected = "SELECT CASE WHEN `Extent1`.`age` IS MISSING THEN 10 ELSE `Extent1`.`age` END as `age` FROM `default` as `Extent1`"; var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression); Assert.AreEqual(expected, n1QlQuery); }
public void Test_IsMissing_ByName() { var mockBucket = new Mock <IBucket>(); mockBucket.SetupGet(e => e.Name).Returns("default"); var query = QueryFactory.Queryable <Contact>(mockBucket.Object) .Where(p => N1Ql.IsMissing(p, "test")); const string expected = "SELECT `Extent1`.* FROM `default` as `Extent1` WHERE `Extent1`.`test` IS MISSING"; var n1QlQuery = CreateN1QlQuery(mockBucket.Object, query.Expression); Assert.AreEqual(expected, n1QlQuery); }