Exemple #1
0
        public void CondensePotentialMatches_Cathedral_Peak_And_Eichorns_Pinnacle()
        {
            string regionName                = "Cathedral Area";
            string formationCathedralPk      = "Cathedral Peak";
            string formationEichornsPinnacle = "Eichorn''s Pinnacle";

            List <FormationMatcher> formationMatchers = new List <FormationMatcher>();
            FormationMatcher        formationMatcher1 = new FormationMatcher(regionName, formationCathedralPk);

            formationMatchers.Add(formationMatcher1);
            FormationMatcher formationMatcher2 = new FormationMatcher(regionName, formationEichornsPinnacle);

            formationMatchers.Add(formationMatcher2);

            List <Formation> formations = new List <Formation>();
            Formation        formation1 = new Formation(formationCathedralPk, 1, 2);

            formations.Add(formation1);
            Formation formation2 = new Formation(formationCathedralPk, 3, 4, subformationName: formationEichornsPinnacle);

            formations.Add(formation2);

            Region region = new Region(regionName, StarRegion);

            region.AddFormationsByRegionName(formationMatchers);
            region.AddFormationsByCoordinates(formations);
            region.MergeFormations();

            Assert.That(region.Formations.Count, Is.EqualTo(2));

            Assert.That(region.Formations[0].MatchedFormation, Is.Null);
            Assert.That(region.Formations[0].PossibleFormations.Count, Is.EqualTo(2));
            Assert.That(region.Formations[0].PossibleFormations[0].Name, Is.EqualTo(formationCathedralPk));
            Assert.That(region.Formations[0].PossibleFormations[0].SubFormationName, Is.Empty);
            Assert.That(region.Formations[0].PossibleFormations[1].Name, Is.EqualTo(formationCathedralPk));
            Assert.That(region.Formations[0].PossibleFormations[1].SubFormationName, Is.EqualTo(formationEichornsPinnacle));

            Assert.That(region.Formations[1].MatchedFormation, Is.Null);
            Assert.That(region.Formations[1].PossibleFormations.Count, Is.EqualTo(1));
            Assert.That(region.Formations[1].PossibleFormations[0].Name, Is.EqualTo(formationCathedralPk));

            region.CondensePotentialMatches();

            Assert.That(region.Formations[0].MatchedFormation, Is.Not.Null);
            int indexCathedral = formations.LastIndexOf(formation1);

            Assert.That(region.Formations[0].MatchedFormation.Name, Is.EqualTo(formations[indexCathedral].Name));
            Assert.That(region.Formations[0].MatchedFormation.OtherName, Is.EqualTo(formations[indexCathedral].OtherName));
            Assert.That(region.Formations[0].MatchedFormation.SubFormationName, Is.EqualTo(formations[indexCathedral].SubFormationName));

            Assert.That(region.Formations[1].MatchedFormation, Is.Not.Null);
            int indexEichorn = formations.LastIndexOf(formation2);

            Assert.That(region.Formations[1].MatchedFormation.Name, Is.EqualTo(formations[indexEichorn].Name));
            Assert.That(region.Formations[1].MatchedFormation.OtherName, Is.EqualTo(formations[indexEichorn].OtherName));
            Assert.That(region.Formations[1].MatchedFormation.SubFormationName, Is.EqualTo(formations[indexEichorn].SubFormationName));
        }
Exemple #2
0
        public void MergeFormations()
        {
            List <FormationMatcher> formationMatchers = new List <FormationMatcher>();

            FormationMatcher nonMatchingFormationMatcher = new FormationMatcher(NAME_REGION + "NonMatching", NAME_FORMATION, NAME_SUBFORMATION);

            formationMatchers.Add(nonMatchingFormationMatcher);
            FormationMatcher matchingFormationMatcher = new FormationMatcher(NAME_REGION, NAME_FORMATION);

            formationMatchers.Add(matchingFormationMatcher);


            List <Formation> formations = new List <Formation>();

            Coordinate coordinateOutside = new Coordinate(120, 5);
            Formation  formationOutside  = new Formation(NAME_FORMATION + "Outside", coordinateOutside);

            formations.Add(formationOutside);

            Coordinate coordinateInside = new Coordinate(23, 90);
            Formation  formationInside  = new Formation(NAME_FORMATION + "Inside", coordinateInside);

            formations.Add(formationInside);

            Coordinate coordinatePartiallyOutside = new Coordinate(25, 21);
            Formation  formationPartiallyOutside  = new Formation(NAME_FORMATION + "PartiallyOutside", coordinatePartiallyOutside);

            formations.Add(formationPartiallyOutside);

            Formation formationOnVertex = new Formation(NAME_FORMATION + "OnVertex", StarRegion[0]);

            formations.Add(formationOnVertex);

            Coordinate coordinateOnShapeSegment = new Coordinate(24, 45);
            Formation  formationOnShapeSegment  = new Formation(NAME_FORMATION + "OnSegment", coordinateOnShapeSegment);

            formations.Add(formationOnShapeSegment);


            Region region = new Region(NAME_REGION, StarRegion);

            region.AddFormationsByRegionName(formationMatchers);
            region.AddFormationsByCoordinates(formations);
            region.MergeFormations();

            Assert.That(region.Formations.Count, Is.EqualTo(1));
            Assert.That(region.Formations[0].MatchedFormation, Is.Null);
            Assert.That(region.Formations[0].PossibleFormations.Count, Is.EqualTo(3));
            Assert.That(region.Formations[0].PossibleFormations[0].Name, Is.EqualTo(NAME_FORMATION + "Inside"));
            Assert.That(region.Formations[0].PossibleFormations[1].Name, Is.EqualTo(NAME_FORMATION + "OnVertex"));
            Assert.That(region.Formations[0].PossibleFormations[2].Name, Is.EqualTo(NAME_FORMATION + "OnSegment"));
        }
Exemple #3
0
        public void AddFormationsByRegionName()
        {
            List <FormationMatcher> formations = new List <FormationMatcher>();
            FormationMatcher        nonMatchingFormationMatcher = new FormationMatcher(NAME_REGION + "NonMatching", NAME_FORMATION, NAME_SUBFORMATION);

            formations.Add(nonMatchingFormationMatcher);
            FormationMatcher matchingFormationMatcher = new FormationMatcher(NAME_REGION, NAME_FORMATION);

            formations.Add(matchingFormationMatcher);

            Region region = new Region(NAME_REGION, StarRegion);

            region.AddFormationsByRegionName(formations);

            Assert.That(region.Formations.Count, Is.EqualTo(1));
            Assert.That(region.Formations[0].FormationName, Is.EqualTo(NAME_FORMATION));
        }
Exemple #4
0
        public void CondensePotentialMatches_Ericcson_Crags_And_Crag_And_Mountain()
        {
            string regionName             = "Collegiate Area";
            string baseName               = "Ericsson";
            string formationMtEricsson    = $"Mount {baseName}";
            string formationEricssonCrags = $"{baseName} Crags";
            string formationEricssonCrag1 = $"{baseName} Crag 1";
            string formationEricssonCrag2 = $"{baseName} Crag 2";
            string formationEricssonCrag3 = $"{baseName} Crag #3";
            string formationEricssonCrag4 = $"{baseName} Crag Number 4";

            List <FormationMatcher> formationMatchers = new List <FormationMatcher>();
            FormationMatcher        formationMatcher1 = new FormationMatcher(regionName, formationEricssonCrags, formationEricssonCrag3);

            formationMatchers.Add(formationMatcher1);
            FormationMatcher formationMatcher2 = new FormationMatcher(regionName, formationMtEricsson);

            formationMatchers.Add(formationMatcher2);

            List <Formation> formations = new List <Formation>();
            Formation        formation1 = new Formation(formationEricssonCrags, 1, 2, subformationName: formationEricssonCrag1);

            formations.Add(formation1);
            Formation formation2 = new Formation(formationEricssonCrags, 3, 4, subformationName: formationEricssonCrag2);

            formations.Add(formation2);
            Formation formation3 = new Formation(formationEricssonCrags, 5, 6, subformationName: formationEricssonCrag3);

            formations.Add(formation3);
            Formation formation4 = new Formation(formationEricssonCrags, 7, 8, subformationName: formationEricssonCrag4);

            formations.Add(formation4);
            Formation formationCrags = new Formation(formationEricssonCrags, 9, 10);

            formations.Add(formationCrags);
            Formation formationMtn = new Formation(formationMtEricsson, 11, 12);

            formations.Add(formationMtn);

            Region region = new Region(regionName, StarRegion);

            region.AddFormationsByRegionName(formationMatchers);
            region.AddFormationsByCoordinates(formations);
            region.MergeFormations();

            Assert.That(region.Formations.Count, Is.EqualTo(2));

            Assert.That(region.Formations[0].MatchedFormation, Is.Null);
            Assert.That(region.Formations[0].PossibleFormations.Count, Is.EqualTo(5));
            Assert.That(region.Formations[0].PossibleFormations[0].SubFormationName, Is.EqualTo(formationEricssonCrag1));
            Assert.That(region.Formations[0].PossibleFormations[1].SubFormationName, Is.EqualTo(formationEricssonCrag2));
            Assert.That(region.Formations[0].PossibleFormations[2].SubFormationName, Is.EqualTo(formationEricssonCrag3));
            Assert.That(region.Formations[0].PossibleFormations[3].SubFormationName, Is.EqualTo(formationEricssonCrag4));
            Assert.That(region.Formations[0].PossibleFormations[4].Name, Is.EqualTo(formationEricssonCrags));

            Assert.That(region.Formations[1].MatchedFormation, Is.Null);
            Assert.That(region.Formations[1].PossibleFormations.Count, Is.EqualTo(1));
            Assert.That(region.Formations[1].PossibleFormations[0].Name, Is.EqualTo(formationMtEricsson));

            region.CondensePotentialMatches();

            Assert.That(region.Formations[0].MatchedFormation, Is.Not.Null);
            int indexCrag = formations.IndexOf(formation3);

            Assert.That(region.Formations[0].MatchedFormation.Name, Is.EqualTo(formations[indexCrag].Name));
            Assert.That(region.Formations[0].MatchedFormation.OtherName, Is.EqualTo(formations[indexCrag].OtherName));
            Assert.That(region.Formations[0].MatchedFormation.SubFormationName, Is.EqualTo(formations[indexCrag].SubFormationName));

            Assert.That(region.Formations[1].MatchedFormation, Is.Not.Null);
            int indexMtn = formations.IndexOf(formationMtn);

            Assert.That(region.Formations[1].MatchedFormation.Name, Is.EqualTo(formations[indexMtn].Name));
            Assert.That(region.Formations[1].MatchedFormation.OtherName, Is.EqualTo(formations[indexMtn].OtherName));
            Assert.That(region.Formations[1].MatchedFormation.SubFormationName, Is.EqualTo(formations[indexMtn].SubFormationName));
        }