コード例 #1
0
        public SectorTest()
        {
            this.altOwners         = SectorAlternateOwnerHierarchyFactory.MakeList();
            this.guests            = SectorGuestFactory.MakeList();
            this.active            = SectorActiveFactory.MakeList();
            this.owners            = SectorOwnerHierarchyFactory.Make();
            this.borders           = SectorBorderFactory.MakeList();
            this.departureAirports = SectorDepartureAirportsFactory.MakeList();
            this.arrivalAirports   = SectorArrivalAirportsFactory.MakeList();

            this.model = new Sector(
                "COOL",
                5000,
                66000,
                this.owners,
                this.altOwners,
                this.active,
                this.guests,
                this.borders,
                this.arrivalAirports,
                this.departureAirports,
                DefinitionFactory.Make(),
                DocblockFactory.Make(),
                CommentFactory.Make()
                );
        }
        public void TestItFailsOnInvalidControllers(string first, string second, string third, int numErrors)
        {
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(first),
                SectorGuestFactory.Make(third),
            }
                    )
                );
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(second),
                SectorGuestFactory.Make(third),
            }
                    )
                );

            AssertValidationErrors(numErrors);
        }
        public void TestItPassesOnValidControllers(string first, string second, string third)
        {
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(first),
                SectorGuestFactory.Make(third),
            }
                    )
                );
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(second),
                SectorGuestFactory.Make(third),
            }
                    )
                );

            AssertNoValidationErrors();
        }
        public void TestItFailsOnInvalid(string first, string second, string third, int timesCalled)
        {
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(firstAirport: first, secondAirport: second),
                SectorGuestFactory.Make(firstAirport: third, secondAirport: "*"),
            }
                    )
                );
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(firstAirport: third, secondAirport: first),
                SectorGuestFactory.Make(firstAirport: "*", secondAirport: "*"),
            }
                    )
                );

            AssertValidationErrors(timesCalled);
        }
        public void TestItPassesOnAllValid(string first, string second, string third)
        {
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(firstAirport: first, secondAirport: second),
                SectorGuestFactory.Make(firstAirport: third, secondAirport: "*"),
            }
                    )
                );
            sectorElements.Add(
                SectorFactory.Make(
                    guests: new List <SectorGuest>
            {
                SectorGuestFactory.Make(firstAirport: third, secondAirport: first),
                SectorGuestFactory.Make(firstAirport: "*", secondAirport: "*"),
            }
                    )
                );

            AssertNoValidationErrors();
        }
 public void TestItPassesOnValidBorders()
 {
     sectorElements.Add(
         new Sector(
             "COOL1",
             5000,
             66000,
             SectorOwnerHierarchyFactory.Make(),
             SectorAlternateOwnerHierarchyFactory.MakeList(2),
             SectorActiveFactory.MakeList(),
             SectorGuestFactory.MakeList(),
             new List <SectorBorder>
     {
         new(
             new List <string>
         {
             "ONE",
             "TWO",
         },
             DefinitionFactory.Make(),
             DocblockFactory.Make(),
             CommentFactory.Make()
             )
     },