Exemplo n.º 1
0
        public void SaveFileIsSameAsOpenFile()
        {
            savegame.SaveTurn();
            string savedFile = savegame.OpenFile(0, "");

            Assert.Contains("Bag content", savedFile);
            Assert.Contains("Player location", savedFile);
            Assert.Contains("END", savedFile);
        }
Exemplo n.º 2
0
        public void WriteSaveGameForPackString()
        {
            Game      withPacks   = new Game(5, 2, 10, false);
            Gamestate withPacksGS = new Gamestate(withPacks);
            Savegame  savegame    = new Savegame(withPacksGS);

            savegame.SaveTurn();
            Gamestate openFile = new Gamestate(withPacks, savegame.OpenFile(0, ""));

            Assert.Equal(withPacks.dungeon.packs, openFile.g.dungeon.packs);
        }
Exemplo n.º 3
0
        public void GameStateIsSameAsBefore()
        {
            Game withItems = new Game(5, 2, 20, false);

            withItems.dungeon.player.PickUp(new HealingPotion("0"));
            withItems.dungeon.player.PickUp(new HealingPotion("1"));
            withItems.dungeon.player.PickUp(new HealingPotion("2"));
            withItems.dungeon.player.PickUp(new HealingPotion("3"));
            withItems.dungeon.turn = 5;
            Gamestate withItemsGS = new Gamestate(withItems);
            Savegame  save        = new Savegame(withItemsGS);

            save.SaveTurn();
            Gamestate fromFile = new Gamestate(g, save.OpenFile(5, ""));

            Assert.Equal(withItemsGS.g.dungeon.player.location.id, fromFile.g.dungeon.player.location.id);
            Assert.Equal(withItemsGS.BagToString(g.dungeon.player.bag), fromFile.BagToString(g.dungeon.player.bag));

            Assert.Equal(withItemsGS.g.dungeon.turn, fromFile.g.dungeon.turn);
        }