Example #1
0
        public async Task checkInVehicle()
        {
            VehiclesController vc        = new VehiclesController();
            Random             random    = new Random();
            Array       tikcets          = Enum.GetValues(typeof(TICKET_TYPE));
            TICKET_TYPE ticketType       = TICKET_TYPE.VIP;
            Array       vehicles         = Enum.GetValues(typeof(VehicleType));
            VehicleType vehicleType      = (VehicleType)vehicles.GetValue(random.Next(0, vehicles.Length - 1));
            long        licensePlateID   = random.Next(0, 100) * 1000 + random.Next(0, 100);
            Vehicle     vehicleToCheckIn = new Vehicle("test" + random.Next(0, 100),
                                                       licensePlateID,
                                                       054 * 1000 + random.Next(0, 100).ToString(),
                                                       vehicleType,
                                                       ticketType,
                                                       random.Next(0, 2),
                                                       random.Next(0, 2),
                                                       random.Next(0, 2)
                                                       );
            IHttpActionResult result = await vc.checkInVehicle(vehicleToCheckIn);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult <Vehicle>));
            Assert.IsNotNull((result as CreatedAtRouteNegotiatedContentResult <Vehicle>).Content);
            Assert.AreNotEqual <int>(0, (result as CreatedAtRouteNegotiatedContentResult <Vehicle>).Content.LotNumber);
        }