Hello,
It seems that confirmation support with an empty phone number has been added for the 9.3.2 Identity Pro
module.
There is an unit test named Create_PhoneNumberConfirmed_With_Empty_PhoneNumber()
has been created, but the [Fact] attribute is missing.
After adding [Fact] attribute and running the test,
the Create
method in the IdentityUserAppService
service is failing.
I'm not sure if the implementation is wrong or the test is wrong. Could you check it?
Yes, we are also aware that UI as well as some SettingsAppService
may need to change/override.
"Generally" we don't need to replace it. I agree
As said before this is advance case scenario where now, we need to replace. But replace is not possible due to access level.
If the Volo.Abp.Emaling
package was previously used in any Application Modules, we would like to eliminate those settings.
I created another custom module which get benefits from existing AbpEmailingModule
meantime it should also make necessary changes for advance use case requirements.
This new module including changes Email send service
, Templates
and etc.
[DependsOn(
typeof(AbpEmailingModule),
typeof(AbpTextTemplatingRazorModule)
)]
public class AbpSiemensEmailingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpSiemensEmailingModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Get<EmailingResource>() // Directly extend an existing resource
.AddVirtualJson("/Siemens/Abp/Emailing/Localization");
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace("Emailing", typeof(EmailingResource));
});
}
}
We are already using the approach that you already shared above.
But it is not possible to Remove any SettingDefinition
in such a use. Isn't it ? If it is can you able to share an example ?
Simply replacing service with [Dependency(ReplaceServices = true)]
attribute we are able to easily make the changes that we want in any SettingProvider
for advance scenarios across Framework and Application Modules . We are very grateful for this.
Can we consider make set access level EmailSettingProvider
class to public
instead internal
.
We don't understand exactly why you felt the need to make it internal
.
Why do we need to write extra code for this EmailSettingProvider
when all other SettingProvider
in the framework are public
and can be overridable with [Dependency(ReplaceServices = true)]
attribute?
https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSettingProvider.cs
Is there a special reason why EmailSettingProvider is internal
but not public
?
Stack Trace:
FeatureCheckerExtensions.CheckEnabledAsync(IFeatureChecker featureChecker, Boolean requiresAll, String[] featureNames)
MethodInvocationFeatureCheckerService.CheckAsync(MethodInvocationFeatureCheckerContext context)
FeatureInterceptor.CheckFeaturesAsync(IAbpMethodInvocation invocation)
FeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapter.ProceedAsync()
ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapter.ProceedAsync()
UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
Suppose we are trying to create a unit/integration test for a method in an application service layer equipped with a [RequiresFeature]
attribute
[RequiresFeature(MyFeatures.MyAwesomeNewFeature)]
public virtual async Task< ItemsDto > GetListOfItemsAsync()
{
return new ItemsDto
{
....
};
}
Already in the ApplicationTestModule
module with the AddAlwaysAllowAuthorization()
extension all Permissions
are being bypassed.
But how can we bypass feature requirement for test purposes ?
public class IMyApplicationTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAlwaysAllowAuthorization();
....
}
}
I tried to mock IFeatureChecker
like in following example. But it broke all other unit test under MyAppService_Tests
public class MyAppService_Tests : IMyApplicationTestBase
{
private readonly IMyAppService _iMyAppService;
private readonly MyOptions _myOptions;
private readonly ISettingProvider _settingProvider;
private IFeatureChecker _featureChecker;
public IMyAppService_Tests()
{
_iMyAppService = GetRequiredService< IMyAppService >();
_myOptions = GetRequiredService< IOptions < MyOptions > >().Value;
_settingProvider = GetRequiredService< ISettingProvider >();
}
protected override void AfterAddApplication(IServiceCollection services)
{
_featureChecker = Substitute.For< IFeatureChecker >();
_featureChecker.IsEnabledAsync(MyFeatures.MyAwesomeNewFeature).Returns(Task.FromResult(true));
services.AddSingleton(_featureChecker);
}
[Fact]
public async Task GetListOfItems_Should_Return_IItemsDto()
{
// Arrange
....
// Act
var result = await _iMyAppService.GetListOfItemsAsync();
// Assert
result.ShouldNotBeNull();
}}
This usage going to throw following exeception ex;
Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module MyCompany.MyTag.MyApp.IdentityTestBaseModule, MyCompany.MyTag.MyApp.TestBase, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null: The input string '' was not in a correct format.. See the inner exception for details.
---- System.FormatException : The input string '' was not in a correct format.
Hello, after updating the framework to 9.1.0 Unit tests are started to fail in our custom SaaS module due missing service registration.
Beside that how you guys managed to release commercial module with failing unit tests :)
Can you guys able to check and fix module accordingly ?
As a workaround;
Base on error message, I temporarily added AbpSettingManagementEntityFrameworkCoreModule
to the EntityFrameworkCore
layer.
This automatically registered missing services.
For the tests;
I extended existing CreateDatabaseAndGetConnection()
method with new SettingManagementDbContext
private static SqliteConnection CreateDatabaseAndGetConnection()
{
var connection = new SqliteConnection("Data Source=:memory:");
connection.Open();
new SaasDbContext(
new DbContextOptionsBuilder<SaasDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new SettingManagementDbContext(
new DbContextOptionsBuilder<SettingManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
return connection;
}
hi
error NU1101: Unable to find package Siemens.PSSX.Users.EntityFrameworkCore. N
o packages exist with this id in source(s): ABP Commercial NuGet Source,How can I restore this package?
Sorry my bad, I forgot this one.. I replaced this one with Volo's Users package and shared it again
hi
Request did not specify a service API version, but multiple candidate actions were found.
Can you share a simple project to reproduce?
liming.ma@volosoft.com
Sent