Ejemplo n.º 1
0
        public async Task SelectNullTest()
        {
            using Sqless sqless = new Sqless(Global.AllowUnspecifiedConfig);
            var selectResult = await sqless.Select(SelectNullTestRequest);

            Assert.IsTrue(selectResult.Count > 0);
        }
Ejemplo n.º 2
0
        public async Task SelectFieldTest()
        {
            using Sqless sqless = new Sqless(Global.AllowUnspecifiedConfig);
            var selectResult = await sqless.Select(SelectFieldTestRequest);

            Assert.IsTrue(selectResult.Count > 0 && (selectResult[0].Uid) == "1");
        }
Ejemplo n.º 3
0
        public async Task SelectTest()
        {
            using Sqless sqless = new Sqless(SelectConfig);
            var result = await sqless.Select(SelectRequest);

            Assert.IsTrue(result.Count > 0);
        }
Ejemplo n.º 4
0
        public async Task RightJoinTest()
        {
            var request = JoinRequest;

            request.Joins[0].SqlessJoinType = SqlessJoinType.RightJoin;

            using Sqless sqless = new Sqless(Global.AllowUnspecifiedConfig);
            var selectResult = await sqless.Select(request);

            Assert.IsTrue(selectResult.Count > 0);
        }
Ejemplo n.º 5
0
        public async Task UnspecifiedFreeTableSelectTest()
        {
            var request = JsonConvert.DeserializeObject <SqlessSelectRequest>(JsonConvert.SerializeObject(SelectRequest));

            request.Table = Tables.AccessToken;

            using Sqless sqless = new Sqless(SelectConfig);
            try
            {
                var result = await sqless.Select(request);
            }
            catch (UnauthorizedAccessException)
            {
                Assert.IsTrue(true);
                return;
            }

            Assert.IsTrue(false);
        }
Ejemplo n.º 6
0
        public async Task AccessSelectTest()
        {
            var request = new SqlessSelectRequest()
            {
                Table    = Tables.User,
                PageSize = 2,
                Fields   = new List <Query.SqlessField>
                {
                    new Query.SqlessField()
                    {
                        Field = "Name"
                    }
                }
            };

            using Sqless sqless = new Sqless(Global.GetOwnerAccessConfig("1"));
            var result = await sqless.Select(request);

            Assert.IsTrue(result.Count > 0);
        }
Ejemplo n.º 7
0
        public virtual async Task <ActionResult> SelectFirstOrDefault(SqlessSelectRequest request)
        {
            using Sqless sqless = await GetSqless(request);

            return(Ok((await sqless.Select(request)).FirstOrDefault()));
        }