feat: Add newProjectConfigureHttpApiModule for API configuration and localization
feat: Implement SampleAppServiceTests for application service testing feat: Create newProjectConfigureApplicationTests project for application layer tests feat: Establish newProjectConfigureDomainTests project for domain layer tests feat: Introduce Entity Framework Core tests for the newProjectConfigure application feat: Develop console test application for HTTP API client demonstration feat: Implement FakeCurrentPrincipalAccessor for testing purposes chore: Set up test base classes and data seed contributors for consistent testing environment
This commit is contained in:
1 parent
7909179fca
commit
b6f2213ccf
279 files changed
+39466
No files matched your search
@@ -0,0 +1,46 @@
|
||||
using System.Threading.Tasks;
|
||||
using Shouldly;
|
||||
using Volo.Abp.Identity;
|
||||
using Volo.Abp.Modularity;
|
||||
using Xunit;
|
||||
|
||||
namespace newProjectConfigure.Samples;
|
||||
|
||||
/* This is just an example test class.
|
||||
* Normally, you don't test code of the modules you are using
|
||||
* (like IdentityUserManager here).
|
||||
* Only test your own domain services.
|
||||
*/
|
||||
public abstract class SampleDomainTests<TStartupModule> : newProjectConfigureDomainTestBase<TStartupModule>
|
||||
where TStartupModule : IAbpModule
|
||||
{
|
||||
private readonly IIdentityUserRepository _identityUserRepository;
|
||||
private readonly IdentityUserManager _identityUserManager;
|
||||
|
||||
protected SampleDomainTests()
|
||||
{
|
||||
_identityUserRepository = GetRequiredService<IIdentityUserRepository>();
|
||||
_identityUserManager = GetRequiredService<IdentityUserManager>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Should_Set_Email_Of_A_User()
|
||||
{
|
||||
IdentityUser adminUser;
|
||||
|
||||
/* Need to manually start Unit Of Work because
|
||||
* FirstOrDefaultAsync should be executed while db connection / context is available.
|
||||
*/
|
||||
await WithUnitOfWorkAsync(async () =>
|
||||
{
|
||||
adminUser = await _identityUserRepository
|
||||
.FindByNormalizedUserNameAsync("ADMIN");
|
||||
|
||||
await _identityUserManager.SetEmailAsync(adminUser, "newemail@abp.io");
|
||||
await _identityUserRepository.UpdateAsync(adminUser);
|
||||
});
|
||||
|
||||
adminUser = await _identityUserRepository.FindByNormalizedUserNameAsync("ADMIN");
|
||||
adminUser.Email.ShouldBe("newemail@abp.io");
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>newProjectConfigure</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\newProjectConfigure.Domain\newProjectConfigure.Domain.csproj" />
|
||||
<ProjectReference Include="..\newProjectConfigure.TestBase\newProjectConfigure.TestBase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace newProjectConfigure;
|
||||
|
||||
/* Inherit from this class for your domain layer tests. */
|
||||
public abstract class newProjectConfigureDomainTestBase<TStartupModule> : newProjectConfigureTestBase<TStartupModule>
|
||||
where TStartupModule : IAbpModule
|
||||
{
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace newProjectConfigure;
|
||||
|
||||
[DependsOn(
|
||||
typeof(newProjectConfigureDomainModule),
|
||||
typeof(newProjectConfigureTestBaseModule)
|
||||
)]
|
||||
public class newProjectConfigureDomainTestModule : AbpModule
|
||||
{
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user