Пример #1
0
        public void TestParsePhaseTest2()
        {
            var lines = File.ReadLines("PhaseTest2.txt").AsParserLines();

            var defs = mScriptParser.Deserialize <PhaseDef>(lines).ToArray();

            ZAssert.IsValidItems(defs, item =>
            {
                SceneAssert.IsValidPhase(item, null, action =>
                {
                    SceneAssert.IsValidDialogue(action, "PATIENT", "My… chest…");
                }, action =>
                {
                    SceneAssert.IsValidDialogue(action, "DANTE", "Quickly cut off the shirt.\nLet’s see what we’re dealing with here.");
                }, action =>
                {
                    SceneAssert.IsValidGunkIndices(action, "SCALPEL", new [] { 1 });
                });
            });
            //
            // SceneAssert.IsValidPhase(phaseDef,
            //     null,
            //     action =>
            //     {
            //         SceneAssert.IsValidDialogue(action, "PATIENT", "My… chest…");
            //     }, action =>
            //     {
            //         SceneAssert.IsValidDialogue(action, "DANTE", "Quickly cut off the shirt.\n" +
            //                                                      "Let’s see what we’re dealing with here.");
            //     }, action =>
            //     {
            //         SceneAssert.IsValidGunkIndices(action, "SCALPEL", new[]{1});
            //     });
        }
Пример #2
0
        public void TestParsePhaseTest1()
        {
            // var lines = LineUtil.GetLinesFromFile("PatientTest.txt").AsParserLines();

            var lines = File.ReadLines("PatientTest.txt").AsParserLines();

            PatientDef patientDef = mScriptParser.Deserialize <PatientDef>(lines).First();

            // PatientDef patientDef = mParseProcess.Deserialize<PatientDef>(lines).First();

            SceneAssert.IsValidPatient(patientDef,
                                       1,
                                       "Hank H.",
                                       new Vitals
            {
                Max      = 60,
                Starting = 40,
            }, (phase) =>
            {
                SceneAssert.IsValidPhase(phase, "chest_shirt_01",
                                         action =>
                {
                    SceneAssert.IsValidGunkInit(action, "WOUND_GLASS", 5);
                });
            },
                                       (phase) =>
            {
                SceneAssert.IsValidPhase(phase, null,
                                         action =>
                {
                    SceneAssert.IsValidDialogue(action, "PATIENT", "My… chest…");
                },
                                         action =>
                {
                    SceneAssert.IsValidDialogue(action, "DANTE", "Quickly cut off the shirt.\n" +
                                                "Let’s see what we’re dealing with here.");
                },
                                         action =>
                {
                    SceneAssert.IsValidGunkIndices(action, "SCALPEL", new [] { 1 });
                });
            },
                                       (phase) =>
            {
                SceneAssert.IsValidPhase(phase, "chest_01",
                                         action =>
                {
                    SceneAssert.IsValidGunkInit(action, "WOUND_STEEL_SMALL", 2);
                },
                                         action =>
                {
                    SceneAssert.IsValidGunkInit(action, "WOUND_CUT_LARGE", 2);
                },
                                         action =>
                {
                    SceneAssert.IsValidGunkInit(action, "WOUND_CUT_SMALL", 3);
                });
            });
            // Assert.AreEqual(1, patientDef.Id);
            // Assert.AreEqual("Hank H.", patientDef.Name);
            // Assert.AreEqual(new Vitals
            // {
            //     Max = 60,
            //     Starting = 40,
            // }, patientDef.Vitals);
            //
            // ZAssert.IsValidItems(patientDef.PhaseDefs, (phase) =>
            //     {
            //         SceneAssert.IsValidPhase(phase, "chest_shirt_01",
            //             action =>
            //         {
            //             SceneAssert.IsValidGunkInit(action, "WOUND_GLASS", 5);
            //         });
            //     },
            //     (phase) =>
            //     {
            //         SceneAssert.IsValidPhase(phase, null,
            //             action =>
            //             {
            //                 SceneAssert.IsValidDialogue(action, "PATIENT", "My… chest…");
            //             },
            //             action =>
            //             {
            //                 SceneAssert.IsValidDialogue(action, "DANTE", "Quickly cut off the shirt.\n" +
            //                                                              "Let’s see what we’re dealing with here.");
            //             },
            //             action =>
            //             {
            //                 SceneAssert.IsValidGunkIndices(action, "SCALPEL", new []{1});
            //             });
            //     },
            //     (phase) =>
            //     {
            //         SceneAssert.IsValidPhase(phase, "chest_01",
            //             action =>
            //             {
            //                 SceneAssert.IsValidGunkInit(action, "WOUND_STEEL_SMALL", 2);
            //             },
            //             action =>
            //             {
            //                 SceneAssert.IsValidGunkInit(action, "WOUND_CUT_LARGE", 2);
            //             },
            //             action =>
            //             {
            //                 SceneAssert.IsValidGunkInit(action, "WOUND_CUT_SMALL", 3);
            //             });
            //     });
        }