Starts in:
2 DAYS
21 HRS
36 MIN
1 SEC
Starts in:
2 D
21 H
36 M
1 S

Activities of "enisn"

Can you share stacktrace?

CMS Kit has only MVC UI implementation currently. On the roadmap, there is no plan about Angular Implementation in current & next milestones.

We'll consider it in next milestones.

  1. There is no official implementation of BoldReports.
  2. I couldn't understand what you mean at second question. Can you explain more what you want to do?

Hi cleverplatform,

Have you ever tried to return object instead of NoContent() from modal page:

public async Task<IActionResult> OnPostAsync()
{
    var created = await _bookAppService.CreateAsync(ObjectMapper.Map<CreateBookViewModel, CreateUpdateBookDto>(Book));
    return new OkObjectResult(created);
}

And add parameters to your javascript function to handle that object.

createModal.onResult(function (result, response) 
{ 
    // response.responseText is your returned object.
    alert(response.responseText.id);
    dataTable.ajax.reload(); 
});

If your LookupRequestDto inherits from PagedAndSortedResultRequestDto you can use Sortingproperty to apply an order.

private IReadOnlyList<LookupDto<Guid?>> Users { get; set; } = new List<LookupDto<Guid?>>();
UsersNullable = (await XXXXAppService.GetAppUserLookupAsync(new LookupRequestDto 
{ 
    Filter = newValue,
    Sorting = "UserName"
})).Items;

And if you implement on your own the repository:


public async Task<PagedResultDto<LookupDto<Guid?>>> GetAppUserLookupAsync(PagedAndSortedResultRequestDto input)
{
    var list = await UserRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, input.Sorting);

    return new PagedResultDto<LookupDto<Guid?>>(
        await UserRepository.GetCountAsync(),
        ObjectMapper.Map<List<AppUser>, List<LookupDto<Guid?>>(list)
    );
}

Hi @vijay.nallala

Guid cannot be converted to ObjectId because they are two different things(different sizes, algoritms).

(https://stackoverflow.com/a/5514441/7200126)

So, you can't change existing Entity ids to ObjectId. You can manage only your entities and your new entities can has ObjectId as Id.

hi davidc

It was not possible to connect to the redis server(s). UnableToConnect on 127.0.0.1:6379

You need set up the Redis for the Public website.

By the way, It's hightly recommended using public website with redis but you can still disable redis in appsettings.json

"Redis": { 
 "IsEnabled": "false",
 "Configuration": "127.0.0.1"
}

following document helps for configuration: https://docs.abp.io/en/abp/latest/Redis-Cache#configuration

Hi @Yaduraj

Can you provide a simple scenario to reproduce problem? I think problem occurs according to your dependencies, For example, you've mocked a Repository but it doesn't return foreign key id or mocked id doesn't match with related entity's id.

Otherwise, in integration test, you shouldn't mock repositories, you should use already seeded datas for testing. Let me introduce a full example that would explain what I meant:

Think there is a PurchaseAppService but this service uses IPaymentService to call a 3rd party API and make payment. Following example shows how to mock 3rd Party PaymentService

  • A couple of DTOs:
public class PaymentResult
{
    public string Code { get; set; }
    public bool Succeeded { get; set; }
}

public class PaymentInput
{
    public decimal Price { get; set; }
    public string SomePaymentInfo { get; set; }
}

public class PurchaseInput
{
    public Guid ProductId { get; set; }
    public int Amount { get; set; }
}
  • And interfaces:
public interface IPaymentService : ITransientDependency
{
    Task<PaymentResult> MakePaymentAsync(PaymentInput input);
}

public interface IPurchaseAppService : IApplicationService
{
    Task PurchaseAsync(PurchaseInput input);
}
  • See the implementation of PurchaseAppService, that calls a 3rd party service over its interface.
public class PurchaseAppService : ApplicationService, IPurchaseAppService
{
    protected IPaymentService PaymentService { get; }
    protected IRepository<Product> ProductRepository { get; }

    public PurchaseAppService(
        IPaymentService paymentService,
        IRepository<Product> productRepository)
    {
        PaymentService = paymentService;
        ProductRepository = productRepository;
    }

    public async Task PurchaseAsync(PurchaseInput input)
    {
        var product = await ProductRepository.GetAsync(x => x.Id == input.ProductId);

        // 3rd Party Service Call
        var paymentResult = await PaymentService.MakePaymentAsync(new PaymentInput
        {
            Price = product.Price * input.Amount,
            SomePaymentInfo = "Some additrional data here..."
        });

        if (!paymentResult.Succeeded)
        {
            throw new BusinessException(message: "Payment is failed...");
        }

        // ...
        // There might be an insert code into Purchases table...
    }
}

  • Tests: In that case, I've already seeded a product with id Guid.Empty
public class PurchaseAppServiceTests : ProjectFApplicationTestBase
{
    private readonly IPurchaseAppService purchaseAppService;
    private IPaymentService paymentService;

    public PurchaseAppServiceTests()
    {
        purchaseAppService = GetRequiredService<IPurchaseAppService>();
    }

    protected override void AfterAddApplication(IServiceCollection services)
    {
        paymentService = Substitute.For<IPaymentService>();

        services.AddSingleton(paymentService);
    }

    [Fact]
    public async Task MakePayment_Should_Be_Failed()
    {
        var paymentInput = new PaymentInput { Price = 10, SomePaymentInfo = "..." };

        paymentService
            .MakePaymentAsync(paymentInput)
            .Returns(Task.FromResult(new PaymentResult { Code = "9901", Succeeded = false }));

        await Should.ThrowAsync<BusinessException>(async () =>
            await purchaseAppService.PurchaseAsync(new PurchaseInput
            {
                ProductId = Guid.Empty,
                Amount = 2
            })
        );
    }

    [Fact]
    public async Task MakePayment_Should_Be_Succeeded()
    {
        var paymentInput = new PaymentInput { Price = 10, SomePaymentInfo = "..." };

        paymentService
            .MakePaymentAsync(paymentInput)
            .Returns(Task.FromResult(new PaymentResult { Code = "0000", Succeeded = true }));

        await Should.NotThrowAsync(async () =>
            await purchaseAppService.PurchaseAsync(new PurchaseInput
            {
                ProductId = Guid.Empty,
                Amount = 2
            })
        );
    }
}

That test scenario mocks IPaymentService methods with no problem.

I highly suggest to check your all injected services and to make sure your seeder seeds consistent data.

And if you still think something is wrong, Feel free to share your scenario with code blocks

Can you share your project of part of project with us and we can see problem.

You can send it to info@abp.io with issue number (#1208) then we'll reproduce problem & see what's wrong.

Hi @Yaduraj,

Can you share some information about the problem that you faced?

Otherwise I have to redirect to NSubstitute Documentation

Showing 481 to 490 of 496 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06