小编Gio*_*gio的帖子

如何在 .net Framework 4.7 上使用 Mediatr 进行集成测试?

我正在使用 Mediatr 库来注册和调用我的 RequestHandler。\n一切都很顺利,直到我开始阅读有关集成测试的更多信息。

\n

编辑后请阅读

\n

我无法调用继承自 RequesHandler 的类。

\n

我的班级是这样的:

\n
public class MyRequestHandler : RequestHandler<MyRequest, MyResponse>\n{\n  ....\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我没有使用 Meditr异步,而是使用 .net Framework 4.7 而不是 asp.net core,因此,一切看起来都返回了我对 asp.net core 的答案。

\n

当我构建时MyTestClass,要构建RequestHandler我必须创建一个ServiceFactory,也许这就是问题,因为我不知道如何。

\n
 public MyClassTest()\n {\n    ServiceFactory sv = null;\n    _mediator = new Mediator(sv);\n }\n
Run Code Online (Sandbox Code Playgroud)\n

编辑

\n

提供更多信息

\n

我的应用程序层中有这个处理程序

\n
public class LogInUserByFormHandler : RequestHandler<LogInUserByFormRequest, LogInUserByFormResponse>\n{\n    private readonly IValidator<LogInUserByFormRequest> _validator;\n\n    public LogInUserByFormHandler(IValidator<LogInUserByFormRequest> validator)\n    {\n        _validator = validator;\n    }\n\n …
Run Code Online (Sandbox Code Playgroud)

c# integration-testing unit-testing mediatr .net-4.7

4
推荐指数
1
解决办法
8259
查看次数

修复安装 ng-bootstrap/ng-bootstrap 时上游依赖冲突

我正在尝试安装 npm install --save @ng-bootstrap/ng-bootstrap 出现以下错误。请帮我解决这个问题。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: bidashboard@0.0.0
npm ERR! Found: @angular/compiler@13.1.3
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"~13.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"13.2.3" from @angular/localize@13.2.3
npm ERR! node_modules/@angular/localize
npm ERR!   peer @angular/localize@"^13.0.0" from @ng-bootstrap/ng-bootstrap@12.0.0
npm ERR!   node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!     @ng-bootstrap/ng-bootstrap@"^12.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency …
Run Code Online (Sandbox Code Playgroud)

npm angular

1
推荐指数
2
解决办法
2万
查看次数