Exemple #1
0
        public async Task checkOutVehicle()
        {
            VehiclesController vc     = new VehiclesController();
            Random             random = new Random();

            Vehicle[] vehicles = vc.GetVehicles().ToArray <Vehicle>();
            if (vehicles.Length > 0)
            {
                Vehicle vehicle = vehicles[random.Next(0, vehicles.Length - 1)];

                IHttpActionResult checkOutResult = await vc.checkOutVehicle(vehicle.LicensePlateID);

                IHttpActionResult afterCheckOutVheicle = await vc.GetVehicle(vehicle.LicensePlateID);

                Assert.IsNotNull(checkOutResult);
                Assert.IsInstanceOfType(checkOutResult, typeof(OkNegotiatedContentResult <Vehicle>));
                Assert.IsNotNull((checkOutResult as OkNegotiatedContentResult <Vehicle>).Content);

                Assert.IsInstanceOfType(afterCheckOutVheicle, typeof(NotFoundResult));
            }
        }