public AllRegionsMustHaveValidPointsTest()
 {
     sectorElements.Add(FixFactory.Make("testfix"));
     sectorElements.Add(VorFactory.Make("testvor"));
     sectorElements.Add(NdbFactory.Make("testndb"));
     sectorElements.Add(AirportFactory.Make("testairport"));
 }
Beispiel #2
0
 public AllSctSidsMustHaveAValidRouteTest()
 {
     sectorElements.Add(FixFactory.Make("testfix"));
     sectorElements.Add(VorFactory.Make("testvor"));
     sectorElements.Add(NdbFactory.Make("testndb"));
     sectorElements.Add(AirportFactory.Make("testairport"));
 }
Beispiel #3
0
 public AllCircleSectorlinesMustHaveValidCentreTest()
 {
     sectorElements.Add(FixFactory.Make("testfix"));
     sectorElements.Add(VorFactory.Make("testvor"));
     sectorElements.Add(NdbFactory.Make("testndb"));
     sectorElements.Add(AirportFactory.Make("testairport"));
 }
Beispiel #4
0
 public AllCoordinationPointsMustHaveValidNextTest()
 {
     sectorElements.Add(FixFactory.Make("testfix"));
     sectorElements.Add(VorFactory.Make("testvor"));
     sectorElements.Add(NdbFactory.Make("testndb"));
     sectorElements.Add(AirportFactory.Make("testairport"));
 }
 public AllRunwaysMustReferenceAnAirportTest()
 {
     loggerMock = new Mock <IEventLogger>();
     sectorElements.Add(AirportFactory.Make("EGKK"));
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(AirportFactory.Make("000A"));
 }
Beispiel #6
0
        private void Add_a_flight()
        {
            using (var session = this._flightUnit.GetSession())
            {
                var repo = session.GetRepository();

                this._cdc    = AirportFactory.GetAirport(AirportType.CharlesDeGaule);
                this._pudong = AirportFactory.GetAirport(AirportType.Pudong);

                this._flight = new Flight()
                {
                    DepartureAirport = this._pudong,
                    ArrivalAirport   = this._cdc,
                    StartDate        = new DateTime(2016, 05, 03, 10, 45, 0),
                    Plane            = new Plane()
                    {
                        GasKind = GasFactory.GetJetFuel(),
                        Kind    = PlaneKindFactory.GetPlane(PlaneType.airbus)
                    }
                };

                repo.Add(this._flight);

                session.Complete();
            }
        }
        public void TestItAddsAirports()
        {
            Airport airport = AirportFactory.Make();

            collection.Add(airport);

            Assert.Equal(airport, collection.Airports[0]);
        }
Beispiel #8
0
 public RoutePointValidatorTest()
 {
     sectorElements = new SectorElementCollection();
     sectorElements.Add(FixFactory.Make("testfix"));
     sectorElements.Add(VorFactory.Make("testvor"));
     sectorElements.Add(NdbFactory.Make("testndb"));
     sectorElements.Add(AirportFactory.Make("testairport"));
 }
Beispiel #9
0
 public AllCoordinationPointsMustHaveValidArrivalRunwaysTest()
 {
     sectorElements.Add(AirportFactory.Make("EGKK"));
     sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09"));
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(RunwayFactory.Make("EGLL", "09R", "09"));
     sectorElements.Add(RunwayFactory.Make("EGLL", "09L", "09"));
     sectorElements.Add(AirportFactory.Make("EGSS"));
 }
 public AllRunwayExitsMustHaveAValidRunwayTest()
 {
     sectorElements.Add(AirportFactory.Make("EGKK"));
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(AirportFactory.Make("EGCC"));
     sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09"));
     sectorElements.Add(RunwayFactory.Make("EGLL", "27L", "09"));
     sectorElements.Add(RunwayFactory.Make("EGLL", "27R", "09"));
     sectorElements.Add(RunwayFactory.Make("EGCC", "23L", "09"));
 }
Beispiel #11
0
 public AllSectorsMustHaveValidActiveRunwayTest()
 {
     sectorElements.Add(AirportFactory.Make("EGKK"));
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(AirportFactory.Make("EGCC"));
     sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09"));
     sectorElements.Add(RunwayFactory.Make("EGLL", "27L", "09"));
     sectorElements.Add(RunwayFactory.Make("EGLL", "27R", "09"));
     sectorElements.Add(RunwayFactory.Make("EGCC", "23L", "09"));
 }
Beispiel #12
0
        public AllSidsMustHaveAValidAirportTest()
        {
            sid1 = SidStarFactory.Make(airport: "EGKK");
            sid2 = SidStarFactory.Make(airport: "EGCC");
            sid3 = SidStarFactory.Make(airport: "EGBB");

            sectorElements.Add(AirportFactory.Make("EGKK"));
            sectorElements.Add(AirportFactory.Make("EGLL"));
            sectorElements.Add(AirportFactory.Make("EGCC"));
        }
        public AllSidsMustHaveAValidRouteTest()
        {
            first  = SidStarFactory.Make(route: new List <string>(new[] { "testfix", "testvor", "testndb", "testairport" }));
            second = SidStarFactory.Make(route: new List <string>(new[] { "nottestfix", "testvor", "testndb", "testairport" }));

            sectorElements.Add(FixFactory.Make("testfix"));
            sectorElements.Add(VorFactory.Make("testvor"));
            sectorElements.Add(NdbFactory.Make("testndb"));
            sectorElements.Add(AirportFactory.Make("testairport"));
        }
Beispiel #14
0
        private void Add_Pudong_and_CDG_aiports()
        {
            using (var session = this._airportUnit.GetSession())
            {
                var repo = session.GetRepository();

                this._cdc    = AirportFactory.GetAirport(AirportType.CharlesDeGaule);
                this._pudong = AirportFactory.GetAirport(AirportType.Pudong);

                repo.Add(this._cdc);
                repo.Add(this._pudong);

                session.Complete();
            }
        }
Beispiel #15
0
        public void TestItReturnsElementsInOrder()
        {
            Airport first  = AirportFactory.Make("EGKK");
            Airport second = AirportFactory.Make("EGCC");
            Airport third  = AirportFactory.Make("EGLL");

            sectorElements.Add(first);
            sectorElements.Add(second);
            sectorElements.Add(third);

            IEnumerable <ICompilableElementProvider> expected = new List <ICompilableElementProvider>()
            {
                second,
                first,
                third
            };

            AssertCollectedItems(expected);
        }
Beispiel #16
0
        public void Setup()
        {
            var parisAirport   = AirportFactory.GetAirport(AirportType.CharlesDeGaule);
            var newYorkAirport = AirportFactory.GetAirport(AirportType.JFK);

            var airbusKind = PlaneKindFactory.GetPlane(PlaneType.airbus);
            var gasKind    = GasFactory.GetJetFuel();

            this._flight = new Flight()
            {
                DepartureAirport = parisAirport,
                ArrivalAirport   = newYorkAirport,
                StartDate        = new DateTime(2001, 6, 6),
                Plane            = new Plane()
                {
                    Kind = airbusKind, GasKind = gasKind
                },
            };
        }
Beispiel #17
0
 public InfoMustHaveValidAirportTest()
 {
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(AirportFactory.Make("EGKK"));
 }
Beispiel #18
0
 public AllAirportsMustHaveUniqueCodeTest()
 {
     airfield1 = AirportFactory.Make("EGKK");
     airfield2 = AirportFactory.Make("EGLL");
     airfield3 = AirportFactory.Make("EGKK");
 }
 public AllSectorsMustHaveValidArrivalAirportsTest()
 {
     sectorElements.Add(AirportFactory.Make("EGKK"));
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(AirportFactory.Make("EGCC"));
 }
Beispiel #20
0
        public void Should_Get_Three_More_Flights()
        {
            using (var flightSession = this._flightUnit.GetSession())
            {
                using (var citySession = this._cityUnit.GetSession())
                {
                    using (var airportSession = this._airportUnit.GetSession())
                    {
                        var fightRepo   = flightSession.GetRepository();
                        var flightsInfo = fightRepo.GetAll();

                        var aiportRepo = airportSession.GetRepository();

                        var parisAirport   = AirportFactory.GetAirport(AirportType.CharlesDeGaule);
                        var newYorkAirport = AirportFactory.GetAirport(AirportType.JFK);
                        var berlinAirport  = AirportFactory.GetAirport(AirportType.berlin);

                        var airports = new[] { parisAirport, newYorkAirport, berlinAirport };

                        var citiesRepo = citySession.GetRepository();
                        citiesRepo.AddRange(airports.Select(ap => ap.City));
                        citySession.Complete();

                        aiportRepo.AddRange(airports);
                        airportSession.Complete();

                        var airbusKind = PlaneKindFactory.GetPlane(PlaneType.airbus);
                        var gasKind    = GasFactory.GetJetFuel();


                        var flights = new List <Flight>()
                        {
                            new Flight()
                            {
                                DepartureAirport = parisAirport,
                                ArrivalAirport   = newYorkAirport,
                                StartDate        = new DateTime(2001, 6, 6),
                                Plane            = new Plane()
                                {
                                    Kind = airbusKind, GasKind = gasKind
                                },
                            },
                            new Flight()
                            {
                                DepartureAirport = newYorkAirport,
                                ArrivalAirport   = berlinAirport,
                                StartDate        = new DateTime(2001, 6, 6),
                                Plane            = new Plane()
                                {
                                    Kind = airbusKind, GasKind = gasKind
                                },
                            },
                            new Flight()
                            {
                                DepartureAirport = parisAirport,
                                ArrivalAirport   = berlinAirport,
                                StartDate        = new DateTime(2001, 6, 6),
                                Plane            = new Plane()
                                {
                                    Kind = airbusKind, GasKind = gasKind
                                },
                            }
                        };

                        fightRepo.AddRange(flights);
                        flightSession.Complete();
                        var result = fightRepo.GetAll();

                        Assert.AreEqual(flightsInfo.Count() + 3, result.Count());
                    }
                }
            }
        }
Beispiel #21
0
        //the database context object as an input parameter
        protected override void Seed(TuiContext context)
        {
            var cities = new List <City>();

            cities.AddRange(new[]
            {
                CityFactory.GetCity(CityType.NewYork),
                CityFactory.GetCity(CityType.Paris),
                CityFactory.GetCity(CityType.Berlin),
                CityFactory.GetCity(CityType.NewJersey),
                CityFactory.GetCity(CityType.Shanghai),
                CityFactory.GetCity(CityType.Beijing),
                CityFactory.GetCity(CityType.Seoul),
                CityFactory.GetCity(CityType.BuenosAires),
                CityFactory.GetCity(CityType.Calcutta),
                CityFactory.GetCity(CityType.Melbourne)
            }
                            );

            cities.ForEach(s => context.Cities.Add(s));

            var airports = new List <Airport>();

            airports.Add(AirportFactory.GetAirport(AirportType.Orly));
            airports.Add(AirportFactory.GetAirport(AirportType.CharlesDeGaule));
            airports.Add(AirportFactory.GetAirport(AirportType.JFK));
            airports.Add(AirportFactory.GetAirport(AirportType.berlin));
            airports.Add(AirportFactory.GetAirport(AirportType.Newwark));
            airports.Add(AirportFactory.GetAirport(AirportType.BuenosAires));
            airports.Add(AirportFactory.GetAirport(AirportType.Pudong));
            airports.Add(AirportFactory.GetAirport(AirportType.Hongqiao));
            airports.Add(AirportFactory.GetAirport(AirportType.Netaji));
            airports.Add(AirportFactory.GetAirport(AirportType.Melbourne));
            airports.Add(AirportFactory.GetAirport(AirportType.Beijing));
            airports.Add(AirportFactory.GetAirport(AirportType.Incheon));
            airports.Add(AirportFactory.GetAirport(AirportType.Gimpo));

            //overwrite city reference
            foreach (var airport in airports)
            {
                if (cities.Any(c => airport.City.Name == c.Name))
                {
                    airport.City = cities.Find(c => airport.City.Name == c.Name);
                }
            }

            airports.ForEach(s => context.Airports.Add(s));

            var gasKind    = GasFactory.GetJetFuel();
            var airbusKind = PlaneKindFactory.GetPlane(PlaneType.airbus);
            var boeingKind = PlaneKindFactory.GetPlane(PlaneType.boeing);

            var flights = new List <Flight>();

            flights.Add(new Flight()
            {
                Plane = new Plane()
                {
                    Kind = airbusKind, GasKind = gasKind
                },
                DepartureAirport = airports[0],
                ArrivalAirport   = airports[3],
                StartDate        = new DateTime(2001, 6, 6, 10, 15, 0)
            });

            flights.Add(new Flight()
            {
                Plane = new Plane()
                {
                    Kind = boeingKind, GasKind = gasKind
                },
                DepartureAirport = airports[2],
                ArrivalAirport   = airports[7],
                StartDate        = new DateTime(2001, 6, 18, 10, 35, 0)
            });

            flights.Add(new Flight()
            {
                Plane = new Plane()
                {
                    Kind = airbusKind, GasKind = gasKind
                },
                DepartureAirport = airports[0],
                ArrivalAirport   = airports[3],
                StartDate        = new DateTime(2001, 6, 9, 13, 15, 0)
            });

            flights.Add(new Flight()
            {
                Plane = new Plane()
                {
                    Kind = boeingKind, GasKind = gasKind
                },
                DepartureAirport = airports[2],
                ArrivalAirport   = airports[1],
                StartDate        = new DateTime(2001, 6, 8, 11, 15, 0)
            });

            flights.ForEach(s => context.Flights.Add(s));
            context.SaveChanges();

            context.Users.Add(new Login.source.User()
            {
                Name = "bob", Password = "******"
            });
            context.SaveChanges();

            base.Seed(context);
        }
Beispiel #22
0
 public AllActiveRunwaysMustReferenceAnAirportTest()
 {
     sectorElements.Add(AirportFactory.Make("EGLL"));
     sectorElements.Add(AirportFactory.Make("EGKK"));
     sectorElements.Add(AirportFactory.Make("EGCC"));
 }