Ejemplo n.º 1
0
        public void VechicleClosestTo_WhenThereAreNoVechicles_NoAvailableVehicleExceptionIsThrown()
        {
            // new Taxi { Id = 1, Location = 1, Name = "Boban", TaxiCompany = new TaxiCompany { Price = 1 } }
            var repo = new InMemoryTaxiRepository(new List <Taxi> {
            });

            repo.VechicleClosestTo(0, 100);
        }
Ejemplo n.º 2
0
        public void VechicleClosestTo_WhenThereAreVechiclesInAcceptableDistance_ClosestIsReturned()
        {
            var closestTaxi = new Taxi {
                Id = 1, Location = 10, Name = "Boban", TaxiCompany = new TaxiCompany {
                    Price = 1
                }
            };
            var distantTaxi = new Taxi {
                Id = 1, Location = 9, Name = "Boban", TaxiCompany = new TaxiCompany {
                    Price = 1
                }
            };

            var repo = new InMemoryTaxiRepository(new List <Taxi> {
                closestTaxi, distantTaxi
            });

            var result = repo.VechicleClosestTo(20, 15);

            Assert.AreEqual(closestTaxi, result);
        }