mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-20 14:16:45 +08:00
28 lines
926 B
C#
28 lines
926 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Util.Data.Sql;
|
|
using Util.Tests.Configs;
|
|
using Xunit;
|
|
|
|
namespace Util.Data.Dapper.Tests.SqlExecutor;
|
|
|
|
/// <summary>
|
|
/// Sql Server Sql执行器测试 - 执行Sql测试
|
|
/// </summary>
|
|
public partial class SqlServerSqlExecutorTest {
|
|
/// <summary>
|
|
/// 测试执行Sql增删改操作
|
|
/// </summary>
|
|
[Fact]
|
|
public async Task TestExecuteAsync() {
|
|
var id = Guid.NewGuid();
|
|
await _sqlExecutor
|
|
.AppendLine( "Insert Products.Product(ProductId,Code) " )
|
|
.Append( "Values(@ProductId,@Code)" )
|
|
.AddParam( "@ProductId", id )
|
|
.AddParam( "Code", TestConfig.Value )
|
|
.ExecuteAsync();
|
|
var result = await _sqlExecutor.Select( "Code" ).From( "Products.Product" ).Where( "ProductId", id ).ToStringAsync();
|
|
Assert.Equal( TestConfig.Value, result );
|
|
}
|
|
} |