示例#1
0
        public void SelectOption_Should_ContaintNextNode()
        {
            // Arrange
            DialogNode <TestContent> realNextNode      = null;
            DialogNode <TestContent> currentDialogNode = DialogNode <TestContent> .CreateNew(content : new TestContent(), dialogOptions : new List <DialogOptionNext <TestContent> > {
            });

            DialogNode <TestContent> nextNode = DialogNode <TestContent> .CreateNew(content : new TestContent(), dialogOptions : new List <DialogOptionNext <TestContent> > {
            });

            DialogOptionNext <TestContent> optionToSelect = new DialogOptionNext <TestContent>(new TestContent(), nextNode);

            void FuncToFire(object sender, DialogNode <TestContent> e)
            {
                realNextNode = e;
            }

            optionToSelect.SelectEvent += FuncToFire;


            // Act
            optionToSelect.Select();

            // Assert
            Assert.Equal(nextNode, realNextNode);
        }
示例#2
0
        public void SelectOption_Should_RaiseEvent()
        {
            // Arrange
            bool isFired = false;
            DialogNode <TestContent> currentDialogNode = DialogNode <TestContent> .CreateNew(content : new TestContent(), dialogOptions : new List <DialogOptionNext <TestContent> > {
            });

            DialogOptionNext <TestContent> optionToSelect = new DialogOptionNext <TestContent>(new TestContent(), DialogNode <TestContent> .CreateNew(content: new TestContent(), dialogOptions: new List <DialogOptionNext <TestContent> > {
            }));

            void FuncToFire(object sender, DialogNode <TestContent> e)
            {
                isFired = true;
            }

            optionToSelect.SelectEvent += FuncToFire;


            // Act
            optionToSelect.Select();

            // Assert
            Assert.True(isFired);
        }