Esempio n. 1
0
        private CharacterDialogVM ElementTextEditTestCreation()
        {
            NpcChatProject   project = new NpcChatProject();
            DialogTree       tree    = project.ProjectDialogs.CreateNewDialogTree();
            DialogTreeBranch branch  = tree.CreateNewBranch();

            Assert.AreEqual(0, branch.Dialog.Count, "This is a new branch and shouldn't have any dialog inside it!");

            int charId;

            Assert.IsTrue(project.ProjectCharacters.RegisterNewCharacter(out charId, "Gerald"));
            DialogSegment dialogSegment = branch.CreateNewDialog(charId);

            Assert.AreEqual(1, branch.Dialog.Count, "Failed to create sample dialog segment");

            dialogSegment.ClearElements();
            Assert.AreEqual(0, dialogSegment.SegmentParts.Count);
            Assert.AreEqual("", dialogSegment.Text);

            CharacterDialogVM testVM = new CharacterDialogVM(project, dialogSegment)
            {
                EditMode         = EditMode.Elements,
                InspectionActive = false
            };

            // make sure creation was valid
            Assert.NotNull(testVM);
            Assert.AreSame(dialogSegment, testVM.DialogSegment);
            Assert.AreEqual(0, testVM.DialogSegment.SegmentParts.Count);

            return(testVM);
        }
Esempio n. 2
0
        public void ElementTextEditTestEditThenInspect()
        {
            CharacterDialogVM testVM        = ElementTextEditTestCreation();
            DialogSegment     dialogSegment = testVM.DialogSegment;

            testVM.EditMode         = EditMode.TextBlock;
            testVM.InspectionActive = true;
            Assert.AreEqual("", testVM.DialogDocument.Text());
            testVM.EditMode = EditMode.Elements;

            // add simple text element
            string elementName = new DialogText().ElementName;

            Assert.IsTrue(testVM.AddDialogElementCommand.CanExecute(elementName));
            testVM.AddDialogElementCommand.Execute(elementName);
            Assert.AreEqual(1, dialogSegment.SegmentParts.Count);

            // edit simple text
            const string simpleText = "This is some simple text";
            DialogText   element    = dialogSegment.SegmentParts.First() as DialogText;

            Assert.NotNull(element);
            element.Text = simpleText;

            // check that all of the characterDialogVMs text matches
            Assert.AreEqual(simpleText, element.Text);
            Assert.AreEqual(simpleText, dialogSegment.Text);
            testVM.EditMode = EditMode.TextBlock;
            Assert.AreEqual(simpleText, testVM.DialogDocument.Text());
        }