SaveDriver() 공개 메소드

public SaveDriver ( IDriver newDriver ) : OpResult
newDriver IDriver
리턴 OpResult
        public void SaveDriverInvalidNullDriver()
        {
            var driverDataProvider = Substitute.For<IDriverDataProvider>();
            driverDataProvider.Save(null).Returns(OpResult.NullParameter);

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

            //Assert
            Assert.AreEqual(OpResult.NullParameter, result);
        }
        public void SaveDriverValid()
        {
            //Arrange
            IDriver driverToSave = new Driver
            {
                ID = 1,
                FirstName = "Dave",
                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.Success, 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);
        }