コード例 #1
0
 public void TestEnrollDeleteReturnsView()
 {
     using (_context = new MutantDbContext(options))
     {
         _context.MutantTable.Add(mutant);
         _context.SaveChanges();
         // Arrange
         EnrollController controller = new EnrollController(_context);
         // Act
         var result = controller.Delete(0);
         // Assert
         Assert.NotNull(result);
     }
 }
コード例 #2
0
 public void TestHomeIndexReturnsView()
 {
     using (_context = new MutantDbContext(options))
     {
         _context.MutantTable.Add(mutant);
         _context.SaveChanges();
         // Arrange
         HomeController controller = new HomeController(_context);
         // Act
         var result = controller.Index();
         // Assert
         Assert.NotNull(result);
     }
 }
コード例 #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, MutantDbContext mutantDbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            mutantDbContext.Database.EnsureCreated();
            app.UseMvc();
        }
コード例 #4
0
 public MutantController(MutantDbContext mutantDbContext)
 {
     _mutantDbContext = mutantDbContext;
 }
コード例 #5
0
 public EnrollController(MutantDbContext context)
 {
     _context = context;
 }
コード例 #6
0
 public HomeController(MutantDbContext context)
 {
     _context = context;
 }