我开始开发一个新的web应用程序,我创建了一个域对象,Inteface,DAL和BLL。
我想在使用之前测试所有这些。
如果我在.net核心2中的web应用程序中使用开发的函数,我在Startup.cs中添加了如下代码:
public void ConfigureServices(IServiceCollection services)
{
**services.AddTransient<ITableOfTableRepository, DBTableOfTableRepository>();**
services.AddMvc();
services.AddSingleton<IConfiguration>(Configuration);
}在我的控制器中添加以下代码
public class TablesController : Controller
{
private readonly ITableOfTableRepository _repository;
public TablesController(ITableOfTableRepository repository)
{
this._repository = repository;
}如何做一个UnitTest项目来测试所有以前在web应用程序中的使用情况?
如何在单元测试中使用依赖注入?
BR
发布于 2017-12-14 19:26:55
如果你想在第一次测试中进行开发.
您将通过几个步骤:
https://stackoverflow.com/questions/47818753
复制相似问题