示例#1
0
        public void TestListAllDriver()
        {
            DriverLogic   d    = new DriverLogic(this.driverRepo.Object);
            List <Driver> newD = new List <Driver>()
            {
                new Driver {
                    DID = Guid.NewGuid().ToString(), TID = Guid.NewGuid().ToString(), DName = "TestTeam", BornYear = 1995, CountryB = "TestC", RaceNumber = 1
                },
                new Driver {
                    DID = Guid.NewGuid().ToString(), TID = Guid.NewGuid().ToString(), DName = "TestTeam2", BornYear = 1995, CountryB = "TestC2", RaceNumber = 2
                }
            };

            List <Driver> expectedoutput = new List <Driver>()
            {
                newD[0], newD[1]
            };

            driverRepo.Setup(x => x.Search()).Returns(newD.AsQueryable());
            var output = d.GetDrivers();

            Assert.That(output, Is.EquivalentTo(expectedoutput));
            Assert.That(output.Count, Is.EqualTo(expectedoutput.Count));
        }
示例#2
0
 public IActionResult AllDriverList()
 {
     return(View(driverLogic.GetDrivers()));
 }
 public IEnumerable <Driver> GetAllDriver()
 {
     return(logic.GetDrivers());
 }