예제 #1
0
        public void GetCarrierDrivers_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",
                Drivers = new List <Driver>
                {
                    new Driver
                    {
                        FullName = "Driver1"
                    },
                    new Driver
                    {
                        FullName = "Driver2"
                    },
                }
            };

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

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

            Assert.True(result.Count == 2);
        }
예제 #2
0
        public IActionResult GetCarrierDrivers(string carrierName)
        {
            var drivers = _carriersService.GetCarrierDrivers(carrierName);

            return(Json(drivers));
        }