File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed
test/WeihanLi.EntityFramework.Test Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 33using WeihanLi . Common ;
44using WeihanLi . Common . Helpers ;
55using Xunit ;
6- using Xunit . Abstractions ;
76
87namespace WeihanLi . EntityFramework . Test ;
98
@@ -40,7 +39,7 @@ public void InsertTest()
4039 [ Fact ]
4140 public async Task InsertAsyncTest ( )
4241 {
43- using ( await _lock . LockAsync ( ) )
42+ using ( await _lock . LockAsync ( cancellationToken : TestContext . Current . CancellationToken ) )
4443 {
4544 await DependencyResolver . TryInvokeAsync < IEFRepository < TestDbContext , TestEntity > > ( async repo =>
4645 {
Original file line number Diff line number Diff line change 66using System . Threading . Tasks ;
77using WeihanLi . Common . Data ;
88using Xunit ;
9- using Xunit . Abstractions ;
109
1110namespace WeihanLi . EntityFramework . Test ;
1211
@@ -193,13 +192,13 @@ await repo.InsertAsync(new TestEntity()
193192
194193 await uow . CommitAsync ( ) ;
195194
196- var committedCount = await repository . CountAsync ( ) ;
195+ var committedCount = await repository . CountAsync ( cancellationToken : TestContext . Current . CancellationToken ) ;
197196 Assert . Equal ( committedCount , beforeCount + 1 ) ;
198197
199198 entity = await repository . DbContext . FindAsync < TestEntity > ( 3 ) ;
200199 Assert . Equal ( new string ( '3' , 6 ) , entity . Name ) ;
201200
202- entity = await repository . DbContext . FindAsync < TestEntity > ( new object [ ] { 4 } , CancellationToken . None ) ;
201+ entity = await repository . DbContext . FindAsync < TestEntity > ( new object [ ] { 4 } , cancellationToken : TestContext . Current . CancellationToken ) ;
203202 Assert . Equal ( new string ( '4' , 6 ) , entity . Name ) ;
204203
205204 Assert . Equal ( 1 , await Repository . DeleteAsync ( 1 ) ) ;
Original file line number Diff line number Diff line change 33 <PropertyGroup >
44 <IsTestProject >true</IsTestProject >
55 <IsPackable >false</IsPackable >
6+ <OutputType >exe</OutputType >
67 <Nullable >disable</Nullable >
8+ <UseMicrosoftTestingPlatformRunner >true</UseMicrosoftTestingPlatformRunner >
9+ <TestingPlatformDotnetTestSupport >true</TestingPlatformDotnetTestSupport >
710 </PropertyGroup >
811
912 <ItemGroup >
1013 <PackageReference Include =" Microsoft.EntityFrameworkCore.InMemory" Version =" $(EFVersion)" />
1114 <PackageReference Include =" Microsoft.EntityFrameworkCore.SqlServer" Version =" $(EFVersion)" />
12- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.12 .0" />
13- <PackageReference Include =" xunit" Version =" 2.9.2 " />
15+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.13 .0" />
16+ <PackageReference Include =" xunit.v3 " Version =" 2.0.0 " />
1417 </ItemGroup >
1518
1619 <ItemGroup >
You can’t perform that action at this time.
0 commit comments