當前位置: 首頁>>代碼示例>>C#>>正文


C# Expression.TestType類代碼示例

本文整理匯總了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);
            }
        }
開發者ID:chrisklepeis,項目名稱:ServiceStack.OrmLite,代碼行數:25,代碼來源:AdditiveExpressionsTest.cs

示例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);
            }
        }
開發者ID:wrx362114,項目名稱:ServiceStack.OrmLite,代碼行數:25,代碼來源:LogicalExpressionsTest.cs

示例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);
            }
        }
開發者ID:wrx362114,項目名稱:ServiceStack.OrmLite,代碼行數:25,代碼來源:ConditionalExpressionTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:16,代碼來源:RelationalExpressionsTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:17,代碼來源:EqualityExpressionsTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:17,代碼來源:EqualityExpressionsTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:17,代碼來源:RelationalExpressionsTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:17,代碼來源:ConditionalExpressionTest.cs

示例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);
        }
開發者ID:JduPreez,項目名稱:ServiceStack.OrmLite,代碼行數:17,代碼來源:UnaryExpressionsTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:17,代碼來源:MultiplicativeExpressionsTest.cs

示例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);
        }
開發者ID:JduPreez,項目名稱:ServiceStack.OrmLite,代碼行數:19,代碼來源:StringFunctionTests.cs

示例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);
            }
        }
開發者ID:wrx362114,項目名稱:ServiceStack.OrmLite,代碼行數:20,代碼來源:ConditionalExpressionTest.cs

示例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);
            }
        }
開發者ID:chrisklepeis,項目名稱:ServiceStack.OrmLite,代碼行數:20,代碼來源:RelationalExpressionsTest.cs

示例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);
            }
        }
開發者ID:navarromattal,項目名稱:ServiceStack.OrmLite,代碼行數:20,代碼來源:UnaryExpressionsTest.cs

示例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);
        }
開發者ID:JackFong,項目名稱:ServiceStack.OrmLite,代碼行數:21,代碼來源:EqualityExpressionsTest.cs


注:本文中的ServiceStack.OrmLite.Tests.Expression.TestType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。