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

Test Cases in Application #10362


User avatar
0
huntethan89 created

Hi,

I am creating test cases for my application.

A method in my service contains a hangfire job to send an email to the user, but when I am trying to use this method in one of my test case in Test project I get below error:-

Can you please let me know what is the issue

Thanks


1 Answer(s)
  • User Avatar
    0
    musa.demir created

    Hi @smartlayer

    You should disable background jobs in your test cases since background jobs work asynchronously.

    See: https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers#disabling-job-execution

    https://github.com/aspnetzero/aspnet-zero-core/blob/fc16ab77828ed5aaebb34a5f923ad6628012fba9/aspnet-core/test/MyCompanyName.AbpZeroTemplate.Test.Base/AbpZeroTemplateTestBaseModule.cs#L44