示例#1
0
        public void TreeMonDbContext_Context_Select_Async_MSSQL()
        {
            Task.Run(async() =>
            {
                TreeMonDbContext context = new TreeMonDbContext("MSSQL_TEST");
                _userAsync = context.GetAll <User>().FirstOrDefault();
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@NAME", _userAsync.Name);
                IEnumerable <User> users = await context.SelectAsync <User>("SELECT * FROM USERS WHERE Name=@NAME", parameters);

                Assert.AreEqual(users.ToList().Count(), 1);
                Assert.AreEqual(users.ToList()[0].Name, _userAsync.Name);
            }).GetAwaiter().GetResult();
        }