コード例 #1
0
ファイル: QueryTest.cs プロジェクト: itetcetera/csharp-sdk
        public async Task String()
        {
            // Start
            LCQuery <LCObject> query = new LCQuery <LCObject>("Hello");

            query.WhereStartsWith("stringValue", "hello");
            List <LCObject> results = await query.Find();

            results.ForEach(item => {
                string str = item["stringValue"] as string;
                Assert.IsTrue(str.StartsWith("hello"));
            });

            // End
            query = new LCQuery <LCObject>("Hello");
            query.WhereEndsWith("stringValue", "world");
            results = await query.Find();

            results.ForEach(item => {
                string str = item["stringValue"] as string;
                Assert.IsTrue(str.EndsWith("world"));
            });

            // Contains
            query = new LCQuery <LCObject>("Hello");
            query.WhereContains("stringValue", ",");
            results = await query.Find();

            results.ForEach(item => {
                string str = item["stringValue"] as string;
                Assert.IsTrue(str.Contains(','));
            });
        }
コード例 #2
0
        public async Task String()
        {
            // Start
            LCQuery <LCObject> query = new LCQuery <LCObject>("Hello");

            query.WhereStartsWith("stringValue", "hello");
            ReadOnlyCollection <LCObject> results = await query.Find();

            foreach (LCObject item in results)
            {
                string str = item["stringValue"] as string;
                Assert.IsTrue(str.StartsWith("hello"));
            }

            // End
            query = new LCQuery <LCObject>("Hello");
            query.WhereEndsWith("stringValue", "world");
            results = await query.Find();

            foreach (LCObject item in results)
            {
                string str = item["stringValue"] as string;
                Assert.IsTrue(str.EndsWith("world"));
            }

            // Contains
            query = new LCQuery <LCObject>("Hello");
            query.WhereContains("stringValue", ",");
            results = await query.Find();

            foreach (LCObject item in results)
            {
                string str = item["stringValue"] as string;
                Assert.IsTrue(str.Contains(','));
            }
        }