public void LinqCreateNotInConditionTest() { AbstractDatabase fakeDb = DatabaseFactory.CreateDatabase("", "System.Data.SqlClient") as AbstractDatabase; SelectCommand expectedCommand = fakeDb.CreateSelectCommand(""); SelectCommand actualCommand = fakeDb.CreateSelectCommand(""); SqlConditionBuilder expectedConditionBuilder = expectedCommand.ConditionBuilder; SqlInsideParametersCondition expectedCondition = expectedConditionBuilder.NotInThese("TestColumn1", "1"); SqlInsideParametersCondition actualCondition = SqlLinqCondition.Create <TestEntity>(actualCommand, c => c.Test1.NotInThese("1")) as SqlInsideParametersCondition; Assert.AreEqual(expectedCondition, actualCondition); SqlInsideParametersCondition expectedCondition2 = expectedConditionBuilder.NotInThese("TestColumn1", "1", "2", "3", "4", "5"); SqlInsideParametersCondition actualCondition2 = SqlLinqCondition.Create <TestEntity>(actualCommand, c => c.Test1.NotInThese("1", "2", "3", "4", "5")) as SqlInsideParametersCondition; Assert.AreEqual(expectedCondition2, actualCondition2); SqlInsideParametersCondition expectedCondition3 = expectedConditionBuilder.NotInThese("TestColumn2", 1, 2, 3, 4, 5); SqlInsideParametersCondition actualCondition3 = SqlLinqCondition.Create <TestEntity>(actualCommand, c => c.Test2.NotInThese(1, 2, 3, 4, 5)) as SqlInsideParametersCondition; Assert.AreEqual(expectedCondition3, actualCondition3); SqlInsideParametersCondition expectedCondition4 = expectedConditionBuilder.NotInThese("TestColumn5", 1, 2, 3, 4, 5); SqlInsideParametersCondition actualCondition4 = SqlLinqCondition.Create <TestEntity>(actualCommand, c => c.Test5.NotInThese(1, 2, 3, 4, 5)) as SqlInsideParametersCondition; Assert.AreEqual(expectedCondition4, actualCondition4); TestEntityRepository repository = new TestEntityRepository(fakeDb); TestEntity entity = new TestEntity() { Test1 = "1", Test2 = 2, Test3 = 3.0, Test4 = DateTime.Now, Test8 = 8 }; SqlInsideCommandCondition expectedCondition5 = expectedConditionBuilder.NotIn("TestColumn4", repository.TableName, s => { s.Query("TestColumn4") .Paged(10, 2) .Where <TestEntity>(c => c.Test1 == "test" && c.Test2 != 222 && c.Test4 < DateTime.Now) .OrderBy <TestEntity>(c => c.Test3, SqlOrderType.Desc); }); Action <SelectCommand> createAnotherSelect = s => { s.Query("TestColumn4") .Paged(10, 2) .Where <TestEntity>(sc => sc.Test1 == "test" && sc.Test2 != 222 && sc.Test4 < DateTime.Now) .OrderBy <TestEntity>(sc => sc.Test3, SqlOrderType.Desc); }; SqlInsideCommandCondition actualCondition5 = SqlLinqCondition.Create <TestEntity>(actualCommand, c => c.Test4.NotIn <TestEntity>(createAnotherSelect)) as SqlInsideCommandCondition; Assert.AreEqual(expectedCondition5, actualCondition5); }