chore 优化代码
This commit is contained in:
@ -5,5 +5,4 @@ namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
[CollectionDefinition(AdminTestConsts.CollectionDefinitionName)]
|
||||
public class AdminEntityFrameworkCoreCollection : ICollectionFixture<AdminEntityFrameworkCoreFixture>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
using KonSoft.Admin.EntityFrameworkCore;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
|
||||
public class AdminEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture<AdminEntityFrameworkCoreFixture>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,5 @@ public class AdminEntityFrameworkCoreFixture : IDisposable
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,5 @@
|
||||
using Volo.Abp;
|
||||
|
||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
|
||||
public abstract class AdminEntityFrameworkCoreTestBase : AdminTestBase<AdminEntityFrameworkCoreTestModule>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@ namespace KonSoft.Admin.EntityFrameworkCore;
|
||||
typeof(AdminApplicationTestModule),
|
||||
typeof(AdminEntityFrameworkCoreModule),
|
||||
typeof(AbpEntityFrameworkCoreSqliteModule)
|
||||
)]
|
||||
)]
|
||||
public class AdminEntityFrameworkCoreTestModule : AbpModule
|
||||
{
|
||||
private SqliteConnection? _sqliteConnection;
|
||||
@ -51,10 +51,7 @@ public class AdminEntityFrameworkCoreTestModule : AbpModule
|
||||
|
||||
services.Configure<AbpDbContextOptions>(options =>
|
||||
{
|
||||
options.Configure(context =>
|
||||
{
|
||||
context.DbContextOptions.UseSqlite(_sqliteConnection);
|
||||
});
|
||||
options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); });
|
||||
});
|
||||
}
|
||||
|
||||
@ -79,4 +76,4 @@ public class AdminEntityFrameworkCoreTestModule : AbpModule
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,5 +6,4 @@ namespace KonSoft.Admin.EntityFrameworkCore.Applications;
|
||||
[Collection(AdminTestConsts.CollectionDefinitionName)]
|
||||
public class EfCoreSampleAppServiceTests : SampleAppServiceTests<AdminEntityFrameworkCoreTestModule>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -6,5 +6,4 @@ namespace KonSoft.Admin.EntityFrameworkCore.Domains;
|
||||
[Collection(AdminTestConsts.CollectionDefinitionName)]
|
||||
public class EfCoreSampleDomainTests : SampleDomainTests<AdminEntityFrameworkCoreTestModule>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.Identity;
|
||||
using Xunit;
|
||||
@ -32,13 +32,13 @@ public class SampleRepositoryTests : AdminEntityFrameworkCoreTestBase
|
||||
*/
|
||||
await WithUnitOfWorkAsync(async () =>
|
||||
{
|
||||
//Act
|
||||
var adminUser = await (await _appUserRepository.GetQueryableAsync())
|
||||
//Act
|
||||
var adminUser = await (await _appUserRepository.GetQueryableAsync())
|
||||
.Where(u => u.UserName == "admin")
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
//Assert
|
||||
adminUser.ShouldNotBeNull();
|
||||
//Assert
|
||||
adminUser.ShouldNotBeNull();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user