public async Task <ActionResult <User> > GetDriver(string userName) { int id = await data.LookupUserId(userName); Library.Driver driver = await data.GetDriverByUserId(id); if (driver == null) { return(await GetUser(userName)); } return(driver); }
public async Task <IActionResult> Upgrade(Library.Driver driver) { int id = await data.LookupUserId(driver.Name); var check = await data.GetDriverByUserId(id); if (check != null) { return(StatusCode(403)); } await data.AddDriver(id, driver.Seats, driver.MeetLoc); return(NoContent()); }
public void TestGetDrive() { Library.Driver driver = new Library.Driver() { Name = "wknain", Pass = "******", Company = "Revature", Seats = 4, MeetLoc = "Garage" }; Library.Destination destination = new Library.Destination("Taco Bell", 1, ""); PickupDrive drive = new PickupDrive(driver, destination, DateTime.Now); int id = 1; var mockRepo = new Mock <IDataRepository>(); mockRepo.Setup(x => x.GetDrive(id)).ReturnsAsync(drive); var actual = mockRepo.Object; Assert.NotNull(actual); }