Closed zhangxianchengvip closed 1 year ago
Try to use virtual
.
[UnitOfWork]
public virtual Task<Terminal> Create(string sn)
Try to use
virtual
.[UnitOfWork] public virtual Task<Terminal> Create(string sn)
I tried using the following code
await WithUnitOfWorkAsync(async () =>
{
Terminal terminal = await _manager.Create(sn); ;
terminal.ShouldNotBeNull();
});
I am writing unit tests based on ABP vnext, but it encountered an error. The following is the relevant code
DomainService:
UnitTest:
When the code is executed to var any=await_ Repository AnyAsync (new TerminalSnEqualSpec (sn)); An error will occur System.ObjectDisposedException : Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. Object name: 'DeviceDbContext'.