예제 #1
0
        public void CallSaveChangesOnUsitData_WhenAirportIsPassed()
        {
            // Arrange
            var mockedData     = new Mock <IUsitData>();
            var airportService = new AirportService(mockedData.Object);

            var mockedAirportRepository = new Mock <IGenericRepository <Airport> >();

            mockedData.Setup(d => d.Airports).Returns(mockedAirportRepository.Object);

            var airport = new Airport()
            {
                Id = 2, Name = "Name"
            };

            // Act
            airportService.AddAirport(airport);

            // Assert
            mockedData.Verify(d => d.SaveChanges(), Times.Once);
        }