Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "dzungle"

Hi @ismcagdas,

I'm newbie to .less file. I can't find the css classes that control those items. Can you show me the specific css classes in the metronic-customize.less file for theme12 as well as how to write custom classes to achieve what we want?

Thank you very much.

Hi @maliming

I found one more call in the TestBaseModule (Test.Base project).

How can I solve this issue?

HI @ismcagdas

This is my screenshot that I want to achieve.

Hi @aaron,

I still get error:

Result Message: Castle.MicroKernel.ComponentRegistrationException : Component Abp.Localization.ApplicationLanguageProvider could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.

Result StackTrace: at Castle.MicroKernel.SubSystems.Naming.DefaultNamingSubSystem.Register(IHandler handler) at Castle.MicroKernel.DefaultKernel.AddCustomComponent(ComponentModel model) at Castle.MicroKernel.Registration.ComponentRegistration1.Castle.MicroKernel.Registration.IRegistration.Register(IKernelInternal kernel) at Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations) at Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations) at Abp.Dependency.IocManager.Register[TType,TImpl](DependencyLifeStyle lifeStyle) in D:\Github\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:line 140 at Abp.Zero.Configuration.LanguageManagementConfig.EnableDbLocalization() in D:\Github\aspnetboilerplate\src\Abp.Zero.Common\Zero\Configuration\LanguageManagementConfig.cs:line 29 at Ips.Tests.IpsTestModule.PreInitialize() in C:\Git\Ips\aspnet-core\test\Ips.Tests\IpsTestModule.cs:line 43 at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 47 at Abp.AbpBootstrapper.Initialize() in D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 155 at Abp.TestBase.AbpIntegratedTestBase1.InitializeAbp() in D:\Github\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:line 53 at Ips.Test.Base.AppTestBase`1..ctor() in C:\Git\Ips\aspnet-core\test\Ips.Test.Base\AppTestBase.cs:line 30 at Ips.Tests.AppTestBase..ctor() at Ips.Tests.Common.CategoryAppService_Tests..ctor() in C:\Git\Ips\aspnet-core\test\Ips.Tests\Common\CategoryAppService_Tests.cs:line 17

Could you please have a check with my TestModule class?

namespace Ips.Tests
{
    [DependsOn(
        typeof(IpsApplicationModule),
        typeof(IpsEntityFrameworkCoreModule),
        typeof(IpsTestBaseModule))]
    public class IpsTestModule : AbpModule
    {
        public IpsTestModule(IpsEntityFrameworkCoreModule abpZeroTemplateEntityFrameworkCoreModule)
        {
            abpZeroTemplateEntityFrameworkCoreModule.SkipDbContextRegistration = true;
        }

        public override void PreInitialize()
        {
            Configuration.UnitOfWork.Timeout = TimeSpan.FromMinutes(30);
            Configuration.UnitOfWork.IsTransactional = false;

            //Disable static mapper usage since it breaks unit tests (see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2052)
            Configuration.Modules.AbpAutoMapper().UseStaticMapper = false;

            //Use database for language management
            Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization();

            RegisterFakeService<AbpZeroDbMigrator>();

            IocManager.Register<IAppUrlService, FakeAppUrlService>();
            IocManager.Register<IWebUrlService, FakeWebUrlService>();
            IocManager.Register<IRecaptchaValidator, FakeRecaptchaValidator>();

            Configuration.ReplaceService<IAppConfigurationAccessor, TestAppConfigurationAccessor>();
            Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);
        }

        public override void Initialize()
        {
            ServiceCollectionRegistrar.Register(IocManager);
        }

        private void RegisterFakeService<TService>()
            where TService : class
        {
            IocManager.IocContainer.Register(
                Component.For<TService>()
                    .UsingFactoryMethod(() => Substitute.For<TService>())
                    .LifestyleSingleton()
            );
        }
    }
}

Here is my code:

namespace Ips.Tests
{
    [DependsOn(
        typeof(IpsApplicationModule),
        typeof(IpsEntityFrameworkCoreModule),
        typeof(IpsTestBaseModule))]
    public class IpsTestModule : AbpModule
    {
        public IpsTestModule(IpsEntityFrameworkCoreModule abpZeroTemplateEntityFrameworkCoreModule)
        {
            abpZeroTemplateEntityFrameworkCoreModule.SkipDbContextRegistration = true;
        }

        public override void PreInitialize()
        {
            Configuration.UnitOfWork.Timeout = TimeSpan.FromMinutes(30);
            Configuration.UnitOfWork.IsTransactional = false;

            //Disable static mapper usage since it breaks unit tests (see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2052)
            Configuration.Modules.AbpAutoMapper().UseStaticMapper = false;

            //Use database for language management
            Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization();

            RegisterFakeService<AbpZeroDbMigrator>();

            IocManager.Register<IAppUrlService, FakeAppUrlService>();
            IocManager.Register<IWebUrlService, FakeWebUrlService>();
            IocManager.Register<IRecaptchaValidator, FakeRecaptchaValidator>();

            Configuration.ReplaceService<IAppConfigurationAccessor, TestAppConfigurationAccessor>();
            Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);
        }

        public override void Initialize()
        {
            ServiceCollectionRegistrar.Register(IocManager);
        }

        private void RegisterFakeService<TService>()
            where TService : class
        {
            IocManager.IocContainer.Register(
                Component.For<TService>()
                    .UsingFactoryMethod(() => Substitute.For<TService>())
                    .LifestyleSingleton()
            );
        }
    }
}

Hi mate,

I have configed module dependency, but still get error running test:

Test Name: Ips.Tests.Common.CategoryAppService_Tests.Should_Get_All_Categories_Without_Any_Filter Test FullName: Ips.Tests.Common.CategoryAppService_Tests.Should_Get_All_Categories_Without_Any_Filter Test Source: C:\Git\Ips\aspnet-core\test\Ips.Tests\Common\CategoryAppService_Tests.cs : line 23 Test Outcome: Failed Test Duration: 0:00:00.001

Result StackTrace: at Castle.MicroKernel.SubSystems.Naming.DefaultNamingSubSystem.Register(IHandler handler) at Castle.MicroKernel.DefaultKernel.AddCustomComponent(ComponentModel model) at Castle.MicroKernel.Registration.ComponentRegistration1.Castle.MicroKernel.Registration.IRegistration.Register(IKernelInternal kernel) at Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations) at Castle.Windsor.WindsorContainer.Register(IRegistration[] registrations) at Abp.Dependency.IocManager.Register[TType,TImpl](DependencyLifeStyle lifeStyle) in D:\Github\aspnetboilerplate\src\Abp\Dependency\IocManager.cs:line 140 at Abp.Zero.Configuration.LanguageManagementConfig.EnableDbLocalization() in D:\Github\aspnetboilerplate\src\Abp.Zero.Common\Zero\Configuration\LanguageManagementConfig.cs:line 29 at Ips.Tests.IpsTestModule.PreInitialize() in C:\Git\Ips\aspnet-core\test\Ips.Tests\IpsTestModule.cs:line 43 at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 47 at Abp.AbpBootstrapper.Initialize() in D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 155 at Abp.TestBase.AbpIntegratedTestBase1.InitializeAbp() in D:\Github\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:line 53 at Ips.Test.Base.AppTestBase`1..ctor() in C:\Git\Ips\aspnet-core\test\Ips.Test.Base\AppTestBase.cs:line 30 at Ips.Tests.AppTestBase..ctor() at Ips.Tests.Common.CategoryAppService_Tests..ctor() in C:\Git\Ips\aspnet-core\test\Ips.Tests\Common\CategoryAppService_Tests.cs:line 17 Result Message: Castle.MicroKernel.ComponentRegistrationException : Component Abp.Localization.ApplicationLanguageProvider could not be registered. There is already a component with that name. Did you want to modify the existing component instead? If not, make sure you specify a unique name.

I guess the test project of version 6.9.1 is not stable. Could you have a look, please?

Hi @aaron,

I have fixed the issue as instructed:

if (IpsConsts.MultiTenancyEnabled == false)
            {
                //var defaultTenant = _context.Tenants.IgnoreQueryFilters().FirstOrDefault(t => t.TenancyName == MultiTenancy.Tenant.DefaultTenantName);
                //tenantId = defaultTenant.Id;
                tenantId = MultiTenancyConsts.DefaultTenantId;
            }

But I still cannot pass the test, here is the error message:

Test Name: Ips.Tests.Common.CategoryAppService_Tests.Should_Get_All_Categories_Without_Any_Filter Test FullName: Ips.Tests.Common.CategoryAppService_Tests.Should_Get_All_Categories_Without_Any_Filter Test Source: C:\Git\Ips\aspnet-core\test\Ips.Tests\Common\CategoryAppService_Tests.cs : line 23 Test Outcome: Failed Test Duration: 0:01:25.11

Result StackTrace: at AutoMapper.Mapper.get_Instance() in C:\projects\automapper\src\AutoMapper\Mapper.cs:line 36 at AutoMapper.Mapper.Map[TDestination](Object source) in C:\projects\automapper\src\AutoMapper\Mapper.cs:line 76 at Ips.Common.CategoryAppService.GetCategories(GetCategoriesInput input) in C:\Git\Ips\aspnet-core\src\Ips.Application\Common\CategoryAppService.cs:line 35 at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task1 actualReturnValue, Func1 postAction, Action1 finalAction) at Abp.Threading.InternalAsyncHelper.AwaitTaskWithFinallyAndGetResult[T](Task1 actualReturnValue, Action`2 finalAction) at Ips.Tests.Common.CategoryAppService_Tests.Should_Get_All_Categories_Without_Any_Filter() in C:\Git\Ips\aspnet-core\test\Ips.Tests\Common\CategoryAppService_Tests.cs:line 26 --- End of stack trace from previous location where exception was thrown --- Result Message: System.InvalidOperationException : Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance.

I really don't know which object, because I just follow the sample and these above are all my codes. As instructed, I also set the MultiTenancyEnabled = false.

Looking at the error message, I guess something wrong happens in the DefaultSettingsCreator (come with the aspnet zero). Can you have a look at the error message, please?

Thank you

And this is my entity, dto, mapping and interface code:

public class Category : FullAuditedEntity
    {
        [Required]
        [MaxLength(CategoryConsts.MaxTitleLength)]
        public virtual string Title { get; set; }

        [Required]
        [MaxLength(CategoryConsts.MaxDescriptionLength)]
        public virtual string Description { get; set; }

        [MaxLength(CategoryConsts.MaxTypeLength)]
        public virtual string Type { get; set; }
    }
public class CategoryListDto : FullAuditedEntityDto
    {
        public string Title { get; set; }

        public string Description { get; set; }

        public string Type { get; set; }
    }
public class GetCategoriesInput
    {
        public string Filter { get; set; }
    }
configuration.CreateMap<Category, CategoryListDto>();
public interface ICategoryAppService : IApplicationService
    {
        Task<ListResultDto<CategoryListDto>> GetCategories(GetCategoriesInput input);
    }

Hi @aaron,

This is my test code:

public class CategoryAppService_Tests : AppTestBase
    {
        private readonly ICategoryAppService _categoryAppService;

        public CategoryAppService_Tests()
        {
            _categoryAppService = Resolve<ICategoryAppService>();
        }

        [Fact]
        public async Task Should_Get_All_Categories_Without_Any_Filter()
        {
            //Act
            var categories = await _categoryAppService.GetCategories(new GetCategoriesInput());

            //Assert
            categories.Items.Count.ShouldBe(2);
        }
    }

This is my service code:

public class CategoryAppService : IpsAppServiceBase, ICategoryAppService
    {
        private readonly IRepository<Category> _categoryRepository;

        public CategoryAppService(IRepository<Category> categoryRepository)
        {
            _categoryRepository = categoryRepository;
        }

        public async Task<ListResultDto<CategoryListDto>> GetCategories(GetCategoriesInput input)
        {
            var categories = await _categoryRepository
                .GetAll()
                .WhereIf(
                    !input.Filter.IsNullOrEmpty(),
                    c => c.Title.Contains(input.Filter) ||
                         c.Description.Contains(input.Filter)
                )
                .OrderBy(c => c.Title)
                .ToListAsync();

            return new ListResultDto<CategoryListDto>(categories.MapTo<List<CategoryListDto>>());
        }
    }
Showing 21 to 30 of 35 entries