コード例 #1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc();
     services.AddScoped <IOrdersService, OrdersService>();
     services.AddScoped <IProductsService, ProductsService>();
     services.AddSwaggerGen(option =>
     {
         option.SwaggerDoc("v1", new Info
         {
             Title   = "Ordering API Documentation",
             Version = "v1"
         });
         // Set the comments path for the Swagger JSON and UI.
         var xmlPath = $@"{System.AppDomain.CurrentDomain.BaseDirectory}\OrderingWebAPI.xml";
         option.IncludeXmlComments(xmlPath, includeControllerXmlComments: true);
     });
     //Populate with random data
     ProductsDataStorage.PopulateProducts();
 }
コード例 #2
0
 //Unit testing help
 public void GenerateData()
 {
     ProductsDataStorage.PopulateProducts();
 }