Exemplo n.º 1
0
        public void TestSetup()
        {
            _aircraftId = 1;
            _plane1     = new Aircraft()
            {
                Id           = _aircraftId, AircraftName = "Strong",
                AircraftType = new AircraftType()
                {
                    Id = 1, AircraftModel = "Tupolev Tu-134", SeatsNumber = 80, Carrying = 47000
                },
                AircraftReleaseDate = new DateTime(2011, 6, 10), ExploitationTimeSpan = new DateTime(2021, 6, 10) - new DateTime(2011, 6, 10)
            };

            _plane1DTO = new DTO.Aircraft
            {
                Id           = _aircraftId, AircraftName = "Strong",
                AircraftType = new DTO.AircraftType()
                {
                    Id = 1, AircraftModel = "Tupolev Tu-134", SeatsNumber = 80, Carrying = 47000
                },
                AircraftReleaseDate = new DateTime(2011, 6, 10), ExploitationTimeSpan = new DateTime(2021, 6, 10) - new DateTime(2011, 6, 10)
            };

            A.CallTo(() => _fakeMapper.Map <Aircraft, DTO.Aircraft>(_plane1)).Returns(_plane1DTO);
            A.CallTo(() => _fakeMapper.Map <DTO.Aircraft, Aircraft>(_plane1DTO)).Returns(_plane1);

            A.CallTo(() => _fakeUnitOfWork.AircraftRepository).Returns(_fakeAircraftRepository);
            A.CallTo(() => _fakeUnitOfWork.Set <AircraftType>()).Returns(_fakeAircraftTypeRepository);
            _aircraftService = new AircraftService(_fakeUnitOfWork, _fakeMapper);
        }
        public void TestSetup()
        {
            _plane = new DTO.Aircraft()
            {
                AircraftName = "StrongWind",
                AircraftType = new DTO.AircraftType()
                {
                    AircraftModel = "Tupolev Tu-134", SeatsNumber = 80, Carrying = 47000
                },
                AircraftReleaseDate  = new DateTime(2011, 6, 10),
                ExploitationTimeSpan = new DateTime(2021, 6, 10) - new DateTime(2011, 6, 10)
            };

            uow = new UnitOfWork(airportContext);
            var mapper = GetAutoMapperConfig().CreateMapper();

            _aircraftService = new AircraftService(uow, mapper);
        }