Exemplo n.º 1
0
        public void VerifyElementsAreClickable()
        {
            String     category   = "Domestic";
            String     animal     = "Sphynx";
            AnimalPage animalPage = homePage.tapAnimal(category, animal);

            Assert.That(animalPage.getHeader().Contains(animal), Is.True,
                        String.Format("Text '{0}' not found in description", animal));
        }
Exemplo n.º 2
0
        public void VerifySearchBoxIsWorking()
        {
            String     animal            = "Highlander";
            String     targetDescription = "The Highlander (also known as the Highlander Shorthair)";
            AnimalPage animalPage        = homePage.searchAnimal(animal);

            Assert.That(animalPage.getDescription().Contains(targetDescription), Is.True,
                        String.Format("Text '{0}' not found in description", targetDescription));
        }
Exemplo n.º 3
0
        public bool LoadData(string path, TabControl tabControl)
        {
            tabControl.TabPages.Clear();
            Animals.Clear();

            //try {
            SaveDocument = XDocument.Load(path);

            GameData = new GameData(SaveDocument.Root.XPathSelectElement("game/tickManager"));

            uniqueIdsManager = new UniqueIDsManager(SaveDocument.Root.XPathSelectElement("game/uniqueIDsManager"));

            var playerFactionDef = EvaluateSingle <XElement>("scenario/playerFaction/factionDef").Value;

            foreach (var element in SaveDocument.Root.XPathSelectElements("game/world/factionManager/allFactions/li"))
            {
                Faction faction = new Faction(element);
                if (faction.Def.Equals(playerFactionDef))
                {
                    PlayerFaction = faction;
                }
                Factions[faction.FactionIDString] = faction;
                PawnsByFactions[faction]          = new List <Pawn>();
            }

            //Console.WriteLine($"playerFaction:{playerFaction}, colonyFaction:{colonyFaction}");

            Dictionary <String, List <PawnData> > pawnDataDir = new Dictionary <string, List <PawnData> >();

            foreach (var pawnData in SaveDocument.Descendants("pawn"))
            {
                String key = pawnData.GetValue();

                List <PawnData> pawnDataList;
                if (!pawnDataDir.TryGetValue(key, out pawnDataList))
                {
                    pawnDataList     = new List <PawnData>();
                    pawnDataDir[key] = pawnDataList;
                }

                pawnDataList.Add(new PawnData(pawnData.Parent));
            }

            foreach (var pawn in SaveDocument.Root.XPathSelectElements("game/world/worldPawns/pawnsAlive/li"))
            {
                Pawn p = new Pawn(pawn);
                if (p.Faction != null)
                {
                    List <PawnData> pawnDataList;
                    if (!pawnDataDir.TryGetValue(p.PawnId, out pawnDataList))
                    {
                        pawnDataList = new List <PawnData>();
                    }
                    p.addPawnData(pawnDataList);

                    PawnsById[p.PawnId] = p;
                    Faction faction = Factions[p.Faction];
                    PawnsByFactions[faction].Add(p);
                }
            }
            SaveThingsByClass = new Dictionary <string, List <SaveThing> >();
            foreach (var thing in SaveDocument.Descendants("thing"))
            {
                if ((string)thing.Attribute("Class") == "Pawn")
                {
                    Pawn p = new Pawn(thing);
                    if (p.Faction != null)
                    {
                        List <PawnData> pawnDataList;
                        if (!pawnDataDir.TryGetValue(p.PawnId, out pawnDataList))
                        {
                            pawnDataList = new List <PawnData>();
                        }
                        p.addPawnData(pawnDataList);

                        PawnsById[p.PawnId] = p;
                        Faction faction = Factions[p.Faction];
                        PawnsByFactions[faction].Add(p);
                    }
                }
                else
                {
                    SaveThing SaveThing = new SaveThing(thing);

                    String key = SaveThing.Class;
                    if (SaveThing.BaseThing != null && SaveThing.BaseThing.BaseName == "BuildingBase")
                    {
                        key = SaveThing.BaseThing.BaseName;
                    }

                    if (SaveThingsByClass.TryGetValue(key, out List <SaveThing> list))
                    {
                        list.Add(SaveThing);
                    }
                    else
                    {
                        List <SaveThing> newList = new List <SaveThing>();
                        newList.Add(SaveThing);
                        SaveThingsByClass.Add(key, newList);
                    }
                }
            }

            if (PawnsByFactions[PlayerFaction].Count == 0)
            {
                throw new Exception("No characters found!\nTry playing the game a little more.");
            }

            colonistPage      = new ColonistPage();
            colonistPage.Dock = DockStyle.Fill;
            animalPage        = new AnimalPage();
            animalPage.Dock   = DockStyle.Fill;
            itemsPage         = new ItemsPage();
            itemsPage.Dock    = DockStyle.Fill;
            buidingsPage      = new BuildingsPage();
            buidingsPage.Dock = DockStyle.Fill;

            relationsPage = new RelationPage();
            generalPage   = new GeneralPage();

            TabPage colonisTabPage   = new TabPage("Colonists");
            TabPage animalsTabPage   = new TabPage("Animals");
            TabPage relationsTabPage = new TabPage("Relations");
            TabPage gameDataTabPage  = new TabPage("General");
            TabPage itemsTabPage     = new TabPage("Items");
            TabPage buildingsTabPage = new TabPage("Buildings");

            colonisTabPage.Controls.Add(colonistPage);
            animalsTabPage.Controls.Add(animalPage);
            itemsTabPage.Controls.Add(itemsPage);
            relationsTabPage.Controls.Add(relationsPage);
            gameDataTabPage.Controls.Add(generalPage);
            buildingsTabPage.Controls.Add(buidingsPage);


            tabControl.TabPages.Add(gameDataTabPage);
            tabControl.TabPages.Add(colonisTabPage);
            tabControl.TabPages.Add(animalsTabPage);
            tabControl.TabPages.Add(relationsTabPage);
            tabControl.TabPages.Add(itemsTabPage);
            tabControl.TabPages.Add(buildingsTabPage);


            return(true);
        }