static void Main(string[] args) { var context = new AppDbContext(); //UserController.AddUser(context); //VendorController.AddVendor(context); //ProductController.AddProduct(context); //RequestController.AddRequest(context); //RequestLineController.AddRequestLine(context); //UserController.GetUserByPk(context); //VendorController.GetVendorByPk(context); //ProductController.GetProductByPk(context); //RequestController.GetRequestsByPk(context); //RequestLineController.GetRequestLinesByPk(context); // UserController.GetAllUsers(context); VendorController.GetAllVendors(context); ProductController.GetAllProducts(context); RequestController.GetAllRequests(context); RequestLineController.GetAllRequestLines(context); // //UserController.UpdateUser(context); //VendorController.UpdateVendors(context); //ProductController.UpdateProduct(context); //RequestController.UpdateRequests(context); //RequestLineController.UpdateRequestLines(context); // //RequestLineController.DeleteRequestLine(context); //RequestController.DeleteRequest(context); //ProductController.DeleteProduct(context); //VendorController.DeleteVendor(context); //UserController.DeleteUser(context); }
public async void TestForGetAllVendors() { var options = new DbContextOptionsBuilder <LeagueContext>() .UseInMemoryDatabase(databaseName: "p3VendorControllerGetVendors") .Options; using (var context = new LeagueContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); Repo r = new Repo(context, new NullLogger <Repo>()); Logic logic = new Logic(r, new NullLogger <Repo>()); VendorController vendorController = new VendorController(logic); var vendor = new Vendor { VendorID = Guid.NewGuid(), VendorInfo = "chicken tenders", VendorName = "bojangles" }; r.Vendors.Add(vendor); await r.CommitSave(); var getVendors = await vendorController.GetAllVendors(); Assert.IsAssignableFrom <IEnumerable <Vendor> >((getVendors as OkObjectResult).Value); } }