本文整理汇总了C#中ServiceStack.OrmLite.Tests.Expression.TestType类的典型用法代码示例。如果您正苦于以下问题:C# TestType类的具体用法?C# TestType怎么用?C# TestType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestType类属于ServiceStack.OrmLite.Tests.Expression命名空间,在下文中一共展示了TestType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_select_variable_add_expression
public void Can_select_variable_add_expression()
{
// ReSharper disable ConvertToConstant.Local
var a = 4;
var b = 3;
// ReSharper restore ConvertToConstant.Local
var expected = new TestType
{
IntColumn = 7,
BoolColumn = true,
StringColumn = "test"
};
EstablishContext(10, expected);
using (var db = OpenDbConnection())
{
var actual = db.Select<TestType>(q => q.IntColumn == a + b);
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
}
示例2: Can_select_logical_and_variable_expression
public void Can_select_logical_and_variable_expression()
{
// ReSharper disable ConvertToConstant.Local
var a = true;
var b = false;
// ReSharper restore ConvertToConstant.Local
var expected = new TestType
{
IntColumn = 12,
BoolColumn = false,
StringColumn = "test"
};
EstablishContext(10, expected);
using (var db = OpenDbConnection())
{
var actual = db.Select<TestType>(q => q.BoolColumn == (a & b));
Assert.IsNotNull(actual);
Assert.Greater(actual.Count, 0);
CollectionAssert.Contains(actual, expected);
}
}
示例3: Can_select_evaluated_conditional_and_expression
public void Can_select_evaluated_conditional_and_expression()
{
// ReSharper disable ConvertToConstant.Local
var a = 10;
var b = 5;
// ReSharper restore ConvertToConstant.Local
var expected = new TestType
{
IntColumn = 3,
BoolColumn = true,
StringColumn = "4"
};
EstablishContext(10, expected);
using (var db = OpenDbConnection())
{
var actual = db.Select<TestType>(q => q.BoolColumn == (a >= b && a > 0));
Assert.IsNotNull(actual);
Assert.Greater(actual.Count, 0);
CollectionAssert.Contains(actual, expected);
}
}
示例4: Can_select_smaller_than_expression
public void Can_select_smaller_than_expression()
{
var expected = new TestType()
{
IntColumn = 1,
BoolColumn = true,
StringColumn = "test"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn < 1);
Assert.IsNotNull(actual);
Assert.AreEqual(0, actual.Count);
}
示例5: Can_select_equals_int_method_expression
public void Can_select_equals_int_method_expression()
{
var expected = new TestType()
{
IntColumn = 3,
BoolColumn = true,
StringColumn = "4"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn == GetValue(3));
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
示例6: Can_select_not_equals_constant_int_expression
public void Can_select_not_equals_constant_int_expression()
{
var expected = new TestType()
{
IntColumn = 3,
BoolColumn = true,
StringColumn = "4"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn != 3);
Assert.IsNotNull(actual);
Assert.AreEqual(10, actual.Count);
CollectionAssert.DoesNotContain(actual, expected);
}
示例7: Can_select_greater_or_equal_than_expression
public void Can_select_greater_or_equal_than_expression()
{
var expected = new TestType()
{
IntColumn = 1,
BoolColumn = true,
StringColumn = "test"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn >= 1);
Assert.IsNotNull(actual);
Assert.AreEqual(11, actual.Count);
CollectionAssert.Contains(actual, expected);
}
示例8: Can_select_conditional_and_expression
public void Can_select_conditional_and_expression()
{
var expected = new TestType()
{
IntColumn = 3,
BoolColumn = true,
StringColumn = "4"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn > 2 && q.IntColumn < 4);
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
示例9: Can_select_unary_not_constant_expression2
public void Can_select_unary_not_constant_expression2()
{
var expected = new TestType()
{
IntColumn = 12,
BoolColumn = false,
StringColumn = "test"
};
EstablishContext(10, expected);
var actual = ConnectionString.OpenDbConnection().Select<TestType>(q => !q.BoolColumn);
Assert.IsNotNull(actual);
Assert.Greater(actual.Count, 0);
CollectionAssert.Contains(actual, expected);
}
示例10: Can_select_constant_multiply_expression
public void Can_select_constant_multiply_expression()
{
var expected = new TestType()
{
IntColumn = 12,
BoolColumn = true,
StringColumn = "test"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn == 4 * 3);
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
示例11: Can_select_using_contains_with_backtick_in_string
public void Can_select_using_contains_with_backtick_in_string()
{
var stringVal = "string`ContainingAQuote";
var expected = new TestType()
{
IntColumn = 7,
BoolColumn = true,
StringColumn = stringVal
};
EstablishContext(10, expected);
var actual = ConnectionString.OpenDbConnection().Select<TestType>(q => q.StringColumn.Contains(stringVal));
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
示例12: Can_select_conditional_or_expression
public void Can_select_conditional_or_expression()
{
var expected = new TestType
{
IntColumn = 3,
BoolColumn = true,
StringColumn = "4"
};
EstablishContext(10, expected);
using (var db = OpenDbConnection())
{
var actual = db.Select<TestType>(q => q.IntColumn == 3 || q.IntColumn < 0);
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
}
示例13: Can_select_greater_than_expression
public void Can_select_greater_than_expression()
{
var expected = new TestType
{
IntColumn = 1,
BoolColumn = true,
StringColumn = "test"
};
EstablishContext(10, expected);
using (var db = OpenDbConnection())
{
var actual = db.Select<TestType>(q => q.IntColumn > 1);
Assert.IsNotNull(actual);
Assert.AreEqual(10, actual.Count);
CollectionAssert.DoesNotContain(actual, expected);
}
}
示例14: Can_select_unary_plus_constant_expression
public void Can_select_unary_plus_constant_expression()
{
var expected = new TestType
{
IntColumn = 12,
BoolColumn = true,
StringColumn = "test"
};
EstablishContext(10, expected);
using (var db = OpenDbConnection())
{
var actual = db.Select<TestType>(q => q.IntColumn == +12);
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}
}
示例15: Can_select_equals_variable_int_expression
public void Can_select_equals_variable_int_expression()
{
// ReSharper disable ConvertToConstant.Local
var columnValue = 3;
// ReSharper restore ConvertToConstant.Local
var expected = new TestType()
{
IntColumn = columnValue,
BoolColumn = true,
StringColumn = "4"
};
EstablishContext(10, expected);
var actual = OpenDbConnection().Select<TestType>(q => q.IntColumn == columnValue);
Assert.IsNotNull(actual);
Assert.AreEqual(1, actual.Count);
CollectionAssert.Contains(actual, expected);
}