public async Task<ActionResult<Library.Drive>> New(PickupDrive drive)
 {
     if (drive.Dest.Id == 0)
     {
         drive.Dest.Id = await data.LookupDestinationId(drive.Dest.Name);
     }
     try
     {
         var d = await data.NewDrive(drive);
         return Ok(d);
     }
     catch (Exception ex)
     {
         logger.Info(ex);
         return BadRequest();
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 private void Setup()
 {
     Join   = new JoinDrive(new Driver(), new Destination(""), DateTime.Now);
     Pickup = new PickupDrive(new Driver(), new Destination(""), DateTime.Now);
 }