// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(o => o.EnableEndpointRouting = false).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddSingleton(x => DtoProfile.CreateMapper()); services.AddSingleton <IContextFactory, ContextFactory>(); services.AddScoped <IProductsService, ProductsService>(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Product API", Version = "v1" }); }); }
public ProductControllerTest() { _productsService = new ProductsServiceFake(); _productController = new ProductController(_productsService, DtoProfile.CreateMapper()); }