コード例 #1
0
        public void TreeMonDbContext_Context_ExecuteNonQuery_Async_MSSQL()
        {
            Task.Run(async() =>
            {
                TreeMonDbContext context = new TreeMonDbContext("MSSQL_TEST");
                _userAsync = context.GetAll <User>().FirstOrDefault();
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@PROVIDER", "UPDATED_ASYNC_PROVIDER");
                parameters.Add("@UUID", _userAsync.UUID);

                int res = await context.ExecuteNonQueryAsync("UPDATE USERS SET ProviderName=@PROVIDER WHERE UUID=@UUID", parameters);

                Assert.AreEqual(res, 1);
                Assert.AreEqual(context.Get <User>(_userAsync.Id).ProviderName, "UPDATED_ASYNC_PROVIDER");
            }).GetAwaiter().GetResult();
        }