Beispiel #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});
            //     });
        }
Beispiel #2
0
        public static void IsValidPhase(PhaseDef phaseDef,
                                        string expectedSurgeryName,
                                        bool assertSize,
                                        params ZAssert.IsValidItem <StageAction>[] actionAssertions)
        {
            Assert.AreEqual(expectedSurgeryName, phaseDef.SurgerySceneName);

            ZAssert.IsValidItems(phaseDef.Actions, assertSize, actionAssertions);
        }
Beispiel #3
0
        public static void IsValidPatient(PatientDef patientDef, int expectedPatientId,
                                          string expectedPatientName,
                                          Vitals expectedVitals,
                                          bool assertSize,
                                          params ZAssert.IsValidItem <PhaseDef>[] phaseAsserts)
        {
            Assert.AreEqual(expectedPatientId, patientDef.Id);
            Assert.AreEqual(expectedPatientName, patientDef.Name);
            Assert.AreEqual(expectedVitals, patientDef.Vitals);

            ZAssert.IsValidItems(patientDef.PhaseDefs, assertSize, phaseAsserts);
        }
Beispiel #4
0
        public static void IsValidLoveMin(StageAction action,
                                          string expectedCharacterDevName,
                                          int expectedMinLove,
                                          bool assertSize,
                                          params ZAssert.IsValidItem <object>[] actionAsserts)
        {
            Assert.AreEqual(StageActionType.LOVE_MIN, action.Type);
            Assert.AreEqual(expectedCharacterDevName, action.CharacterDevName);
            Assert.AreEqual(expectedMinLove, action.LoveAmount);

            Assert.IsNotNull(action.TrueBranch, "Expected that love min action defined a true branch");

            ZAssert.IsValidItems(action.TrueBranch, assertSize, actionAsserts);
        }
Beispiel #5
0
        public void TestFromXmlStream()
        {
            FileStream fs = new FileStream("test.xml", FileMode.Open, FileAccess.Read);

            var scene = SceneConvert.FromXmlStream(fs);

            Assert.AreEqual("hand_left", scene.Name);
            Assert.AreEqual(BackgroundType.External, scene.BgType);

            ZAssert.IsValidItems(scene.Entities,
                                 entity =>
            {
                Assert.AreEqual("WOUND_GLASS", entity.Tag);
                Assert.AreEqual(new Vector2(1.4f, 1.4f), entity.Position);
                Assert.AreEqual(1.4f, entity.Rotation);
            },
                                 entity =>
            {
                Assert.AreEqual("WOUND_GLASS", entity.Tag);
                Assert.AreEqual(new Vector2(1.4f, 1.4f), entity.Position);
                Assert.AreEqual(1.4f, entity.Rotation);
            },
                                 entity =>
            {
                Assert.AreEqual("WOUND_GLASS", entity.Tag);
                Assert.AreEqual(new Vector2(1.4f, 1.4f), entity.Position);
                Assert.AreEqual(1.4f, entity.Rotation);
            },
                                 entity =>
            {
                Assert.AreEqual("HEMORRHAGE", entity.Tag);
                Assert.AreEqual(new Vector2(1.4f, 1.4f), entity.Position);
                Assert.AreEqual(1.4f, entity.Rotation);
            },
                                 entity =>
            {
                Assert.AreEqual("HEMORRHAGE", entity.Tag);
                Assert.AreEqual(new Vector2(1.4f, 1.4f), entity.Position);
                Assert.AreEqual(1.4f, entity.Rotation);
            });
        }
Beispiel #6
0
 public static void IsValidGunkIndices(StageAction action, string gunkType, int[] gunkIndices)
 {
     Assert.AreEqual(StageActionType.GUNK_INDICES, action.Type);
     Assert.AreEqual(gunkType, action.GunkType);
     ZAssert.AreEqual(gunkIndices, action.GunkIndices);
 }
Beispiel #7
0
 public static void IsValidCutScene(CutSceneDef cutSceneDef,
                                    params ZAssert.IsValidItem <StageAction>[] actionAsserts)
 {
     ZAssert.IsValidItems(cutSceneDef.Actions, true, actionAsserts);
 }