public void WhereNot() { var q = Builders <MyModel> .Select(x => new { x.Id }) .Where(x => !(x.Id == 1 && x.Name == "test")); var b = WhereBuilder <MyModel> .Not(WhereBuilder <MyModel> .And( WhereBuilder <MyModel> .FromExpression(x => x.Id == 1), WhereBuilder <MyModel> .Eq(x => x.Name, "test"))); Utils.AssertRawQuery(q, b, @"SELECT ""id"" FROM model WHERE NOT(((""id"") = (1)) AND ((""name"") = ('test')))"); }
public void Column_WithNotCondition_AddsConditionToList() { var whereConditions = new List <WhereCondition>(); var builder = new WhereBuilder("table", whereConditions); builder.Not().Column("id", 1); whereConditions.Should() .ContainSingle() .Which.Should() .BeEquivalentTo(new CompareCondition("table", "id", "=", 1) { IsNot = true }); }
public void Grouped_WithNotCondition_AddsConditionToList() { var whereConditions = new List <WhereCondition>(); var builder = new WhereBuilder("table", whereConditions); builder.Not().Grouped(where => { }); whereConditions.Should() .ContainSingle() .Which.Should() .BeEquivalentTo(new NestedCondition(new List <WhereCondition>()) { IsNot = true }); }