Browse Source

deleted not used test projects

pull/5004/head
İsmail ÇAĞDAŞ 6 years ago
parent
commit
bdcf018528
  1. 25
      modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj
  2. 2
      modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj.DotSettings
  3. 7
      modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/AbpUserRepository_Tests.cs
  4. 38
      modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/AbpUsersEntityFrameworkCoreTestModule.cs
  5. 7
      modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/ExternalUserLookupService_Tests.cs
  6. 7
      modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/LocalUserLookupService_Tests.cs
  7. 25
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj
  8. 8
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/AbpUserRepository_Tests.cs
  9. 31
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/AbpUsersMongoDbTestModule.cs
  10. 8
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/ExternalUserLookupService_Tests.cs
  11. 8
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/LocalUserLookupService_Tests.cs
  12. 22
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/MongoDbFixture.cs
  13. 10
      modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/MongoTestCollection.cs
  14. 31
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo.Abp.Users.Tests.Shared.csproj
  15. 2
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo.Abp.Users.Tests.Shared.csproj.DotSettings
  16. 53
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUserRepository_Tests.cs
  17. 27
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersExternalTestData.cs
  18. 17
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersLocalTestData.cs
  19. 14
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestBase.cs
  20. 29
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestDataBuilder.cs
  21. 34
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestsSharedModule.cs
  22. 77
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/ExternalUserLookupService_Tests.cs
  23. 28
      modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/LocalUserLookupService_Tests.cs

25
modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Volo.Abp.Users.EntityFrameworkCore.Tests</AssemblyName>
<PackageId>Volo.Abp.Users.EntityFrameworkCore.Tests</PackageId>
<LangVersion>latest</LangVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Users.EntityFrameworkCore\Volo.Abp.Users.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\test\Volo.Abp.Users.Tests.Shared\Volo.Abp.Users.Tests.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.4" />
</ItemGroup>
</Project>

2
modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj.DotSettings

@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp71</s:String></wpf:ResourceDictionary>

7
modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/AbpUserRepository_Tests.cs

@ -1,7 +0,0 @@
namespace Volo.Abp.Users.EntityFrameworkCore
{
public class AbpUserRepository_Tests : AbpUserRepository_Tests<AbpUsersEntityFrameworkCoreTestModule>
{
}
}

38
modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/AbpUsersEntityFrameworkCoreTestModule.cs

@ -1,38 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;
namespace Volo.Abp.Users.EntityFrameworkCore
{
[DependsOn(
typeof(AbpUsersTestsSharedModule),
typeof(AbpUsersEntityFrameworkCoreModule)
)]
public class AbpUsersEntityFrameworkCoreTestModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddEntityFrameworkInMemoryDatabase();
var databaseName = Guid.NewGuid().ToString();
services.Configure<AbpDbContextOptions>(options =>
{
options.Configure(context =>
{
context.DbContextOptions.UseInMemoryDatabase(databaseName);
});
});
services.Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; //EF in-memory database does not support transactions
});
services.AddAssemblyOf<AbpUsersEntityFrameworkCoreTestModule>();
}
}
}

7
modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/ExternalUserLookupService_Tests.cs

@ -1,7 +0,0 @@
namespace Volo.Abp.Users.EntityFrameworkCore
{
public class ExternalUserLookupService_Tests : ExternalUserLookupService_Tests<AbpUsersEntityFrameworkCoreTestModule>
{
}
}

7
modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo/Abp/Users/EntityFrameworkCore/LocalUserLookupService_Tests.cs

@ -1,7 +0,0 @@
namespace Volo.Abp.Users.EntityFrameworkCore
{
public class LocalUserLookupService_Tests : LocalUserLookupService_Tests<AbpUsersEntityFrameworkCoreTestModule>
{
}
}

25
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Volo.Abp.Users.MongoDB.Tests</AssemblyName>
<PackageId>Volo.Abp.Users.MongoDB.Tests</PackageId>
<LangVersion>latest</LangVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Users.MongoDB\Volo.Abp.Users.MongoDB.csproj" />
<ProjectReference Include="..\..\test\Volo.Abp.Users.Tests.Shared\Volo.Abp.Users.Tests.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
</ItemGroup>
</Project>

8
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/AbpUserRepository_Tests.cs

@ -1,8 +0,0 @@
namespace Volo.Abp.Users.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class AbpUserRepository_Tests : AbpUserRepository_Tests<AbpUsersMongoDbTestModule>
{
}
}

31
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/AbpUsersMongoDbTestModule.cs

@ -1,31 +0,0 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Mongo2Go;
using Volo.Abp.Data;
using Volo.Abp.Modularity;
namespace Volo.Abp.Users.MongoDB
{
[DependsOn(
typeof(AbpUsersMongoDbModule),
typeof(AbpUsersTestsSharedModule)
)]
public class AbpUsersMongoDbTestModule : AbpModule
{
private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start();
public override void ConfigureServices(IServiceCollection services)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
services.AddAssemblyOf<AbpUsersMongoDbTestModule>();
}
}
}

8
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/ExternalUserLookupService_Tests.cs

@ -1,8 +0,0 @@
namespace Volo.Abp.Users.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class ExternalUserLookupService_Tests : ExternalUserLookupService_Tests<AbpUsersMongoDbTestModule>
{
}
}

8
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/LocalUserLookupService_Tests.cs

@ -1,8 +0,0 @@
namespace Volo.Abp.Users.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class LocalUserLookupService_Tests : LocalUserLookupService_Tests<AbpUsersMongoDbTestModule>
{
}
}

22
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/MongoDbFixture.cs

@ -1,22 +0,0 @@
using System;
using Mongo2Go;
namespace Volo.Abp.Users.MongoDB
{
public class MongoDbFixture : IDisposable
{
private static readonly MongoDbRunner MongoDbRunner;
public static readonly string ConnectionString;
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
ConnectionString = MongoDbRunner.ConnectionString;
}
public void Dispose()
{
MongoDbRunner?.Dispose();
}
}
}

10
modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo/Abp/Users/MongoDB/MongoTestCollection.cs

@ -1,10 +0,0 @@
using Xunit;
namespace Volo.Abp.Users.MongoDB
{
[CollectionDefinition(Name)]
public class MongoTestCollection : ICollectionFixture<MongoDbFixture>
{
public const string Name = "MongoDB Collection";
}
}

31
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo.Abp.Users.Tests.Shared.csproj

@ -1,31 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssemblyName>Volo.Abp.Users.Tests.Shared</AssemblyName>
<PackageId>Volo.Abp.Users.Tests.Shared</PackageId>
<LangVersion>latest</LangVersion>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Users.Domain\Volo.Abp.Users.Domain.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.TestBase\Volo.Abp.TestBase.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NSubstitute" Version="4.2.1" />
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
</Project>

2
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo.Abp.Users.Tests.Shared.csproj.DotSettings

@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp71</s:String></wpf:ResourceDictionary>

53
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUserRepository_Tests.cs

@ -1,53 +0,0 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Modularity;
using Xunit;
namespace Volo.Abp.Users
{
public abstract class AbpUserRepository_Tests<TStartupModule> : AbpUsersTestBase<TStartupModule>
where TStartupModule : IAbpModule
{
private readonly AbpUsersLocalTestData _localTestData;
private readonly IAbpUserRepository _userRepository;
protected AbpUserRepository_Tests()
{
_userRepository = GetRequiredService<IAbpUserRepository>();
_localTestData = GetRequiredService<AbpUsersLocalTestData>();
}
[Fact]
public async Task FindAsync()
{
var john = await _userRepository.FindAsync(_localTestData.John.Id);
john.ShouldNotBeNull();
john.UserName.ShouldBe(_localTestData.John.UserName);
//Undefined user
(await _userRepository.FindAsync(Guid.NewGuid())).ShouldBeNull();
}
[Fact]
public async Task FindByUserNameAsync()
{
var john = await _userRepository.FindByUserNameAsync(_localTestData.John.UserName);
john.ShouldNotBeNull();
john.Id.ShouldBe(_localTestData.John.Id);
//Undefined user
(await _userRepository.FindByUserNameAsync("undefined-user")).ShouldBeNull();
}
[Fact]
public async Task GetListAsync()
{
(await _userRepository.GetListAsync(new Guid[0])).Any().ShouldBeFalse();
(await _userRepository.GetListAsync(new[] { _localTestData.John.Id })).Count.ShouldBe(1);
(await _userRepository.GetListAsync(new[] { _localTestData.John.Id, _localTestData.David.Id })).Count.ShouldBe(2);
(await _userRepository.GetListAsync(new[] { _localTestData.John.Id, _localTestData.David.Id, Guid.NewGuid() })).Count.ShouldBe(2);
}
}
}

27
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersExternalTestData.cs

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Users
{
public class AbpUsersExternalTestData : ISingletonDependency
{
public IAbpUserData David { get; }
public IAbpUserData Neo { get; }
public AbpUsersExternalTestData(AbpUsersLocalTestData localTestData)
{
Neo = new AbpUserData(Guid.NewGuid(), "neo");
David = localTestData.David.ToAbpUserData();
}
public List<IAbpUserData> GetAllUsers()
{
return new List<IAbpUserData>
{
David,
Neo
};
}
}
}

17
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersLocalTestData.cs

@ -1,17 +0,0 @@
using System;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Users
{
public class AbpUsersLocalTestData : ISingletonDependency
{
public AbpUser John { get; }
public AbpUser David { get; }
public AbpUsersLocalTestData()
{
John = new AbpUser(Guid.NewGuid(), "john");
David = new AbpUser(Guid.NewGuid(), "david", "david@abp.io");
}
}
}

14
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestBase.cs

@ -1,14 +0,0 @@
using Volo.Abp.Modularity;
using Volo.Abp.Testing;
namespace Volo.Abp.Users
{
public abstract class AbpUsersTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule>
where TStartupModule : IAbpModule
{
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options)
{
options.UseAutofac();
}
}
}

29
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestDataBuilder.cs

@ -1,29 +0,0 @@
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Users
{
public class AbpUsersTestDataBuilder : ITransientDependency
{
private readonly IAbpUserRepository _userRepository;
private readonly AbpUsersLocalTestData _localTestData;
public AbpUsersTestDataBuilder(
IAbpUserRepository userRepository,
AbpUsersLocalTestData localTestData)
{
_userRepository = userRepository;
_localTestData = localTestData;
}
public void Build()
{
AddUsers();
}
private void AddUsers()
{
_userRepository.Insert(_localTestData.John);
_userRepository.Insert(_localTestData.David);
}
}
}

34
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/AbpUsersTestsSharedModule.cs

@ -1,34 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
namespace Volo.Abp.Users
{
[DependsOn(
typeof(AbpUsersDomainModule),
typeof(AbpTestBaseModule),
typeof(AbpAutofacModule)
)]
public class AbpUsersTestsSharedModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpUsersTestsSharedModule>();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
SeedTestData(context);
}
private static void SeedTestData(ApplicationInitializationContext context)
{
using (var scope = context.ServiceProvider.CreateScope())
{
scope.ServiceProvider
.GetRequiredService<AbpUsersTestDataBuilder>()
.Build();
}
}
}
}

77
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/ExternalUserLookupService_Tests.cs

@ -1,77 +0,0 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Modularity;
using Xunit;
namespace Volo.Abp.Users
{
public abstract class ExternalUserLookupService_Tests<TStartupModule> : AbpUsersTestBase<TStartupModule>
where TStartupModule : IAbpModule
{
private readonly IAbpUserLookupService _lookupService;
private readonly AbpUsersLocalTestData _localTestData;
private readonly AbpUsersExternalTestData _externalTestData;
protected ExternalUserLookupService_Tests()
{
_lookupService = GetRequiredService<IAbpUserLookupService>();
_localTestData = GetRequiredService<AbpUsersLocalTestData>();
_externalTestData = GetRequiredService<AbpUsersExternalTestData>();
}
protected override void AfterAddApplication(IServiceCollection services)
{
services.AddTransient<IExternalAbpUserLookupServiceProvider, TestExternalAbpUserLookupServiceProvider>();
}
[Fact]
public async Task FindByUserNameAsync()
{
(await GetRequiredService<IAbpUserRepository>().FindByUserNameAsync(_localTestData.John.UserName)).ShouldNotBeNull();
(await _lookupService.FindByUserNameAsync("undefined-user")).ShouldBeNull();
(await _lookupService.FindByUserNameAsync(_localTestData.John.UserName)).ShouldBeNull(); //Because it's not available in the external provider. And this will delete the user!
(await _lookupService.FindByUserNameAsync(_localTestData.David.UserName)).ShouldNotBeNull();
(await _lookupService.FindByUserNameAsync(_externalTestData.Neo.UserName)).ShouldNotBeNull();
(await GetRequiredService<IAbpUserRepository>().FindByUserNameAsync(_localTestData.John.UserName)).ShouldBeNull();
}
[Fact]
public async Task FindByIdAsync()
{
(await GetRequiredService<IAbpUserRepository>().FindAsync(_localTestData.John.Id)).ShouldNotBeNull();
(await _lookupService.FindByIdAsync(Guid.NewGuid())).ShouldBeNull();
(await _lookupService.FindByIdAsync(_localTestData.John.Id)).ShouldBeNull(); //Because it's not available in the external provider. And this will delete the user!
(await _lookupService.FindByIdAsync(_localTestData.David.Id)).ShouldNotBeNull();
(await _lookupService.FindByIdAsync(_externalTestData.Neo.Id)).ShouldNotBeNull();
(await GetRequiredService<IAbpUserRepository>().FindAsync(_localTestData.John.Id)).ShouldBeNull();
}
public class TestExternalAbpUserLookupServiceProvider : IExternalAbpUserLookupServiceProvider
{
private readonly AbpUsersExternalTestData _externalTestData;
public TestExternalAbpUserLookupServiceProvider(AbpUsersExternalTestData externalTestData)
{
_externalTestData = externalTestData;
}
public Task<IAbpUserData> FindByIdAsync(Guid id, CancellationToken cancellationToken = default)
{
return Task.FromResult(_externalTestData.GetAllUsers().FirstOrDefault(u => u.Id == id));
}
public Task<IAbpUserData> FindByUserNameAsync(string userName, CancellationToken cancellationToken = default)
{
return Task.FromResult(_externalTestData.GetAllUsers().FirstOrDefault(u => u.UserName == userName));
}
}
}
}

28
modules/users/test/Volo.Abp.Users.Tests.Shared/Volo/Abp/Users/LocalUserLookupService_Tests.cs

@ -1,28 +0,0 @@
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.Modularity;
using Xunit;
namespace Volo.Abp.Users
{
public abstract class LocalUserLookupService_Tests<TStartupModule> : AbpUsersTestBase<TStartupModule>
where TStartupModule : IAbpModule
{
private readonly IAbpUserLookupService _lookupService;
private readonly AbpUsersLocalTestData _localTestData;
protected LocalUserLookupService_Tests()
{
_lookupService = GetRequiredService<IAbpUserLookupService>();
_localTestData = GetRequiredService<AbpUsersLocalTestData>();
}
[Fact]
public async Task FindByUserNameAsync()
{
(await _lookupService.FindByUserNameAsync(_localTestData.John.UserName)).ShouldNotBeNull();
(await _lookupService.FindByUserNameAsync(_localTestData.David.UserName)).ShouldNotBeNull();
(await _lookupService.FindByUserNameAsync("undefined-user")).ShouldBeNull();
}
}
}
Loading…
Cancel
Save