상속: IDriver
        public void GetDriverByIDValid()
        {
            IDriver driverToFind = new Driver
            {
                ID = 1,
                FirstName = "Dave",
                LastName = "Grayson",
            };

            //Arrange
            var driverDataProvider = Substitute.For<IDriverDataProvider>();
            driverDataProvider.GetById(driverToFind.ID).Returns(driverToFind);

            //Act
            var driverListViewModel = new DriverModel(driverDataProvider);
            var result = driverListViewModel.GetDriverDetails(driverToFind.ID);

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(driverToFind.ID, result.ID);
            Assert.AreEqual(driverToFind.FirstName, result.FirstName);
            Assert.AreEqual(driverToFind.LastName, result.LastName);
        }
        public void UpdateDriverValid()
        {
            //Arrange
            IDriver driverToSave = new Driver
            {
                ID = 1,
                FirstName = "Dave",
                LastName = "Grayson",
                Country = "Scotland",
                CardNumber = "098765789"
            };

            var driverDataProvider = Substitute.For<IDriverDataProvider>();
            driverDataProvider.Update(driverToSave).Returns(OpResult.Success);

            //Act
            var driverModel = new DriverModel(driverDataProvider);
            OpResult result = driverModel.UpdateDriver(driverToSave);

            //Assert
            Assert.AreEqual(OpResult.Success, result);
        }
        public void SaveDriverInvalidDriverAlreadyExists()
        {
            IDriver driverToSave = new Driver
            {
                ID = 1,
                FirstName = "Dave",
                LastName = "Grayson",
                Country = "Scotland",
                CardNumber = "098765789"
            };

            var driverDataProvider = Substitute.For<IDriverDataProvider>();
            driverDataProvider.Save(driverToSave).Returns(OpResult.ObjectExists);

            //Act
            var driverModel = new DriverModel(driverDataProvider);
            OpResult result = driverModel.SaveDriver(driverToSave);

            //Assert
            Assert.AreEqual(OpResult.ObjectExists, result);
        }
        public void SaveDriverInvalidDriverDetails()
        {
            IDriver driverToSave = new Driver
            {
                ID = 1,
                FirstName = string.Empty,
                LastName = "Grayson",
                Country = "Scotland",
                CardNumber = "098765789"
            };

            var driverDataProvider = Substitute.For<IDriverDataProvider>();
            driverDataProvider.Save(driverToSave).Returns(OpResult.Success);

            //Act
            var driverModel = new DriverModel(driverDataProvider);
            OpResult result = driverModel.SaveDriver(driverToSave);

            //Assert
            Assert.AreEqual(OpResult.InvalidParameters, result);
        }
        public void GetDriverByNameUnknownDriver()
        {
            IDriver result = null;
            IDriver driverToFind = new Driver
            {
                FirstName = "Dave",
                LastName = "Grayson",
            };
            //Arrange
            var driverDataProvider = Substitute.For<IDriverDataProvider>();
            driverDataProvider.GetByName(driverToFind.FullName).Returns(x => null);

            //Act
            var driverListViewModel = new DriverModel(driverDataProvider);

            result = driverListViewModel.GetDriverByName(driverToFind.FullName);

            //Assert
            Assert.IsNull(result);
        }