示例#1
0
        private static string LoadAndTestOS(ScreenManager screenMan, out int errorsAdded)
        {
            int    errorCount = 0;
            string str1       = "";
            string username   = "******";
            string pass       = "******";

            SaveFileManager.AddUser(username, pass);
            string fileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(username);

            OS.TestingPassOnly = true;
            OS os1 = new OS();

            os1.SaveGameUserName    = fileNameForUsername;
            os1.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os1, new PlayerIndex?(screenMan.controllingPlayer));
            SessionAccelerator.AccelerateSessionToDLCEND((object)os1);
            os1.PreDLCVisibleNodesCache = "123,456,789";
            os1.delayer.RunAllDelayedActions();
            os1.threadedSaveExecute(false);
            List <Computer> nodes = os1.netMap.nodes;

            screenMan.RemoveScreen((GameScreen)os1);
            OS.WillLoadSave = true;
            OS os2 = new OS();

            os2.SaveGameUserName    = fileNameForUsername;
            os2.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os2, new PlayerIndex?(screenMan.controllingPlayer));
            os2.delayer.RunAllDelayedActions();
            Game1.getSingleton().IsMouseVisible = true;
            if (os2.PreDLCVisibleNodesCache != "123,456,789")
            {
                ++errorCount;
                str1 += "PreDLC Visible Node Cache not saving correctly";
            }
            screenMan.RemoveScreen((GameScreen)os2);
            string str2 = str1 + TestSuite.getTestingReportForLoadComparison((object)os2, nodes, errorCount, out errorCount) + "\r\n" + TestSuite.TestMissions((object)os2);
            string str3 = DLCTests.TestDLCFunctionality(screenMan, out errorsAdded);
            string str4 = str2 + (str3.Length > 30 ? "\r\n" + str3 : "");

            errorsAdded = errorCount;
            return(str4);
        }
示例#2
0
        private static string LoadAndTestOS(ScreenManager screenMan, out int errorsAdded)
        {
            int    errorCount = 0;
            string str1       = "";
            string username   = "******";
            string pass       = "******";

            SaveFileManager.AddUser(username, pass);
            string fileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(username);

            OS.TestingPassOnly = true;
            OS os1 = new OS();

            os1.SaveGameUserName    = fileNameForUsername;
            os1.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os1, new PlayerIndex?(screenMan.controllingPlayer));
            os1.delayer.RunAllDelayedActions();
            os1.threadedSaveExecute(false);
            List <Computer> nodes = os1.netMap.nodes;

            screenMan.RemoveScreen((GameScreen)os1);
            OS.WillLoadSave = true;
            OS os2 = new OS();

            os2.SaveGameUserName    = fileNameForUsername;
            os2.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os2, new PlayerIndex?(screenMan.controllingPlayer));
            os2.delayer.RunAllDelayedActions();
            Game1.getSingleton().IsMouseVisible = true;
            screenMan.RemoveScreen((GameScreen)os2);
            string str2 = str1 + TestSuite.getTestingReportForLoadComparison((object)os2, nodes, errorCount, out errorCount) + "\r\n" + TestSuite.TestMissions((object)os2);

            errorsAdded = errorCount;
            return(str2);
        }
示例#3
0
        public static string TestSaveLoadOnFile(ScreenManager screenMan, bool IsQuicktestMode = false)
        {
            string username = "******";
            string pass     = "******";

            SaveFileManager.AddUser(username, pass);
            string fileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(username);

            OS.TestingPassOnly = true;
            string str1 = "";
            OS     os1  = new OS();

            os1.SaveGameUserName    = fileNameForUsername;
            os1.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os1, new PlayerIndex?(screenMan.controllingPlayer));
            os1.delayer.RunAllDelayedActions();
            os1.threadedSaveExecute(false);
            List <Computer> nodes1 = os1.netMap.nodes;

            screenMan.RemoveScreen((GameScreen)os1);
            OS.WillLoadSave = true;
            OS os2 = new OS();

            os2.SaveGameUserName    = fileNameForUsername;
            os2.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os2, new PlayerIndex?(screenMan.controllingPlayer));
            os2.delayer.RunAllDelayedActions();
            Game1.getSingleton().IsMouseVisible = true;
            string str2 = "Serialization and Integrity Test Report:\r\n";

            Console.WriteLine(str2);
            string        str3        = str1 + str2;
            List <string> stringList1 = new List <string>();
            List <string> stringList2 = new List <string>();
            int           errorCount  = 0;
            string        str4        = str3 + TestSuite.getTestingReportForLoadComparison((object)os2, nodes1, errorCount, out errorCount) + "\r\n" + TestSuite.TestMissions((object)os2);
            int           errorsOut   = 0;
            string        str5        = str4 + TestSuite.TestGameProgression((object)os2, out errorsOut);
            int           num         = errorCount + errorsOut;

            for (int index = 0; index < os2.netMap.nodes.Count; ++index)
            {
                TestSuite.DeleteAllFilesRecursivley(os2.netMap.nodes[index].files.root);
            }
            os2.SaveGameUserName    = fileNameForUsername;
            os2.SaveUserAccountName = username;
            os2.threadedSaveExecute(false);
            List <Computer> nodes2 = os2.netMap.nodes;

            screenMan.RemoveScreen((GameScreen)os2);
            OS.WillLoadSave = true;
            OS os3 = new OS();

            os3.SaveGameUserName    = fileNameForUsername;
            os3.SaveUserAccountName = username;
            screenMan.AddScreen((GameScreen)os3, new PlayerIndex?(screenMan.controllingPlayer));
            screenMan.RemoveScreen((GameScreen)os3);
            OS.TestingPassOnly = false;
            SaveFileManager.DeleteUser(username);
            int errorsAdded = 0;

            if (!IsQuicktestMode)
            {
                str5 = str5 + "\r\nLocalization Tests: " + LocalizationTests.TestLocalizations(screenMan, out errorsAdded) + "\r\nDLC Localization Tests: " + DLCLocalizationTests.TestDLCLocalizations(screenMan, out errorsAdded);
            }
            string str6 = str5 + "\r\nDLC Tests: " + DLCTests.TestDLCFunctionality(screenMan, out errorsAdded) + "\r\nDLC Extended Tests: " + DLCExtendedTests.TesExtendedFunctionality(screenMan, out errorsAdded) + "\r\nEDU Edition Tests: " + EduEditionTests.TestEDUFunctionality(screenMan, out errorsAdded) + "\r\nMisc Tests: " + TestSuite.TestMiscAndCLRFeatures(screenMan, out errorsAdded);
            string str7 = "\r\nCore Tests: Complete - " + (object)num + " errors found.\r\nTested " + (object)nodes2.Count + " generated nodes vs " + (object)os3.netMap.nodes.Count + " loaded nodes";
            string str8 = str6 + str7;

            Console.WriteLine(str7);
            MusicManager.stop();
            try
            {
                string str9 = "testreport.txt";
                File.Delete(str9);
                Utils.writeToFile(str8, str9);
            }
            catch (Exception ex)
            {
            }
            return(Utils.CleanStringToRenderable(str8));
        }