Exemplo n.º 1
0
        public void CheckCreatingDriver()
        {
            // Arrange
            Driver driver = DriverObjectMother.CreateDriver();

            deliveryFactoryMock.Setup(factory =>
                                      factory.CreateDriver(driver.name, driver.surname, driver.address))
            .Returns(driver);

            // Act
            Driver returnedDriver = deliveryService.CreateNewDriver(driver.name, driver.surname, driver.address);

            // Assert
            driverRepositoryMock.Verify(r => r.InsertDriver(driver), Times.Once());
            Assert.AreSame(driver, returnedDriver);
        }