//[TestMethod] public async Task testPostC() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "testCreateinPostC") .Options; using (var context = new ApplicationDbContext(options)) { context.Students.Add(student1); context.Users.Add(appU1); context.SaveChanges(); }; using (var context = new ApplicationDbContext(options)) { var service = new MyProjectController(context); var result = await service.PostC(crProjView1); Assert.AreEqual(result.Name, "rkerker"); } }
public async Task testPostU() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "testMyPostU") .Options; using (var context = new ApplicationDbContext(options)) { context.Projects.Add(proj1); context.Students.Add(student1); context.Users.Add(appU1); context.SaveChanges(); }; using (var context = new ApplicationDbContext(options)) { var service = new MyProjectController(context); var result = await service.PostU(projView1); Assert.AreEqual(result.Description, "sampleView"); } }