Exemple #1
0
        public void GetCarrierVehicles_works_Properly()
        {
            string errorMessagePrefix = "CarriersService GetCarrierDrivers() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.carriersService = new CarriersService(context);

            var carrier = new Carrier
            {
                Name     = "Carrier1",
                Vehicles = new List <Vehicle>
                {
                    new Vehicle()
                    {
                        RegNumber = "RegNumber1"
                    },
                    new Vehicle()
                    {
                        RegNumber = "RegNumber2"
                    },
                }
            };

            context.Carriers.Add(carrier);
            context.SaveChanges();

            var result = carriersService.GetCarrierVehicles(carrier.Name);

            Assert.True(result.Count == 2);
        }
Exemple #2
0
        public IActionResult GetCarrierVehicles(string carrierName)
        {
            var vehicles = _carriersService.GetCarrierVehicles(carrierName);

            return(Json(vehicles));
        }