Exemplo n.º 1
0
        public void MainController_WriteSaveData()
        {
            MainController mc = new MainController();

            Assert.IsTrue(mc.InitialiseGameFromSave(), "Save game should be succesfully initialized");
            GameState workingGS = mc.GetGameState();

            PCModel        workingPCM = workingGS.GetPCM();
            LocationModel  workingLM  = workingGS.GetLM();
            EventModel     workingEM  = workingGS.GetEM();
            DiscoveryModel workingDM  = workingGS.GetDM();

            Assert.IsTrue(mc.WriteSaveData(), "Save Data should be sucessfully written");

            FileReadWriter frw           = new FileReadWriter();
            String         pc            = frw.ReadSaveDataFile(FileReadWriter.PLAYER_CHARACTER);
            String         inventory     = frw.ReadSaveDataFile(FileReadWriter.INVENTORY);
            String         usedEvents    = frw.ReadSaveDataFile(FileReadWriter.USED_EVENTS);
            String         currentEvent  = frw.ReadSaveDataFile(FileReadWriter.CURRENT_EVENT);
            String         discovered    = frw.ReadSaveDataFile(FileReadWriter.DISCOVERED);
            String         visitedLocs   = frw.ReadSaveDataFile(FileReadWriter.VISITED);
            String         unvisitedLocs = frw.ReadSaveDataFile(FileReadWriter.UNVISISTED);
            String         currLoc       = frw.ReadSaveDataFile(FileReadWriter.CURRENT_LOCATION);
            String         currSLoc      = frw.ReadSaveDataFile(FileReadWriter.CURRENT_SUBLOCATION);

            String workingPC           = workingPCM.GetPC().ParseToString();
            String workingInventory    = workingPCM.GetInventory().ParseToString();
            String workingUsedEvents   = workingEM.ParseUsedEventsToString();
            String workingCurrentEvent = workingEM.ParseCurrentEventToString();
            String workingDiscovered   = workingDM.ParseDiscoveredToString();
            String workingVisited      = workingLM.ParseVisitedToString();
            String workingUnvisited    = workingLM.ParseUnvisitedToString();
            String workingCurrLocation = workingLM.ParseCurrLocationToString();
            String workingCurrSLoc     = workingLM.ParseCurrSubLocToString();

            Assert.AreEqual(workingPC, pc, "Saved PC should match");
            Assert.AreEqual(workingInventory, inventory, "Saved Inventory should match");
            Assert.AreEqual(workingUsedEvents, usedEvents, "Saved Used Events should match");
            Assert.AreEqual(workingCurrentEvent, currentEvent, "Saved Current events should match");
            Assert.AreEqual(workingDiscovered, discovered, "Saved Discovered should match");
            Assert.AreEqual(workingVisited, visitedLocs, "Saved Visited should match");
            Assert.AreEqual(workingUnvisited, unvisitedLocs, "Saved Unvisisted should match");
            Assert.AreEqual(workingCurrLocation, currLoc, "Saved Curr location should match");
            Assert.AreEqual(workingCurrSLoc, currSLoc, "Saved Curr Sublocation should match");
        }
Exemplo n.º 2
0
        public void MainController_IntialiseGameFromSave()
        {
            //FileReadWriter frw = new FileReadWriter();
            //frw.WriteSaveDataFile(FileReadWriter.DIFFICULTY_CONTROLLER, dc.ParseToString());
            //frw.WriteSaveDataFile(FileReadWriter.PLAYER_CHARACTER, pc);
            //frw.WriteSaveDataFile(FileReadWriter.INVENTORY, inventory);
            //frw.WriteSaveDataFile(FileReadWriter.USED_EVENTS, usedEvents);
            //frw.WriteSaveDataFile(FileReadWriter.CURRENT_EVENT, currentEvent);
            //frw.WriteSaveDataFile(FileReadWriter.DISCOVERED, discovered);
            //frw.WriteSaveDataFile(FileReadWriter.VISITED, visitedLocs);
            //frw.WriteSaveDataFile(FileReadWriter.UNVISISTED, unvisitedLocs);
            //frw.WriteSaveDataFile(FileReadWriter.CURRENT_LOCATION, currLoc);
            //frw.WriteSaveDataFile(FileReadWriter.CURRENT_SUBLOCATION, currSLoc);
            MainController mc = new MainController();

            Assert.IsTrue(mc.InitialiseGameFromSave(), "Save game should be succesfully initialized");
            GameState workingGS = mc.GetGameState();

            PCModel        workingPCM = workingGS.GetPCM();
            LocationModel  workingLM  = workingGS.GetLM();
            EventModel     workingEM  = workingGS.GetEM();
            DiscoveryModel workingDM  = workingGS.GetDM();

            String workingPC           = workingPCM.GetPC().ParseToString();
            String workingInventory    = workingPCM.GetInventory().ParseToString();
            String workingUsedEvents   = workingEM.ParseUsedEventsToString();
            String workingCurrentEvent = workingEM.ParseCurrentEventToString();
            String workingDiscovered   = workingDM.ParseDiscoveredToString();
            String workingVisited      = workingLM.ParseVisitedToString();
            String workingUnvisited    = workingLM.ParseUnvisitedToString();
            String workingCurrLocation = workingLM.ParseCurrLocationToString();
            String workingCurrSLoc     = workingLM.ParseCurrSubLocToString();

            Assert.AreEqual(pc, workingPC, "PC should match");
            Assert.AreEqual(inventory, workingInventory, "Inventory should match");
            Assert.AreEqual(usedEvents, workingUsedEvents, "Used Events should match");
            Assert.AreEqual(currentEvent, workingCurrentEvent, "Current events should match");
            Assert.AreEqual(discovered, workingDiscovered, "Discovered should match");
            Assert.AreEqual(visitedLocs, workingVisited, "Visited should match");
            Assert.AreEqual(unvisitedLocs, workingUnvisited, "Unvisisted should match");
            Assert.AreEqual(currLoc, workingCurrLocation, "Curr location should match");
            Assert.AreEqual(currSLoc, workingCurrSLoc, "Curr Sublocation should match");
        }
Exemplo n.º 3
0
        public void DiscoveryModel_ParseToString()
        {
            dm = new DiscoveryModel(validStrings[2].Item1, dc.ParseToString());

            Assert.AreEqual(validStrings[2].Item1, dm.ParseDiscoveredToString(), "String should match");
        }
Exemplo n.º 4
0
 /// <summary>
 /// Parses Discovered to String
 /// </summary>
 /// <returns>Discovered as a string</returns>
 public String ParseDiscoveredToString()
 {
     return(dm.ParseDiscoveredToString());
 }