示例#1
0
        public void SaveAndLoadAProgram()
        {
            const string saveName    = "SaveAndLoadAProgramTest.json";
            const string programName = "PrintMagicNumber";
            const string sourceCode  = "print(42)";

            int programObjectId;

            {
                Program p = _programRunner.CreateProgram(programName, sourceCode, "unknown");
                programObjectId = p.objectId;
                _relay.SaveAll(saveName);
            }

            {
                RelayTwo      relay         = new RelayTwo(saveName);
                ProgramRunner programRunner = new ProgramRunner(relay);
                Program       p             = programRunner.GetProgram(programObjectId);
                Assert.AreEqual(programName, p.name);
                Assert.AreEqual(sourceCode, p.sourceCodeContent);
            }
        }