コード例 #1
0
        public void AdaptiveDialog_GetInternalVersion()
        {
            var ds       = new TestAdaptiveDialog();
            var version1 = ds.GetInternalVersion_Test();

            Assert.NotNull(version1);

            var version2 = ds.GetInternalVersion_Test();

            Assert.NotNull(version2);
            Assert.Equal(version1, version2);

            var ds2 = new TestAdaptiveDialog()
            {
                Triggers = new List <OnCondition>()
                {
                    new OnIntent("foo")
                    {
                    }
                }
            };

            var version3 = ds2.GetInternalVersion_Test();

            Assert.NotNull(version3);
            Assert.NotEqual(version2, version3);

            ds2 = new TestAdaptiveDialog()
            {
                Triggers = new List <OnCondition>()
                {
                    new OnIntent("foo")
                    {
                        Condition = "user.name == 'joe'"
                    }
                }
            };

            var version4 = ds2.GetInternalVersion_Test();

            Assert.NotNull(version4);
            Assert.NotEqual(version3, version4);

            var ds3 = new TestAdaptiveDialog()
            {
                Triggers = new List <OnCondition>()
                {
                    new OnIntent("foo")
                    {
                        Condition = "user.name == 'joe'",
                        Actions   = new List <Dialog>()
                        {
                            new SendActivity()
                            {
                                Activity = new ActivityTemplate("yo")
                            }
                        }
                    }
                }
            };

            var version5 = ds3.GetInternalVersion_Test();

            Assert.NotNull(version5);
            Assert.NotEqual(version4, version5);

            var version6 = ds3.GetInternalVersion_Test();

            Assert.Equal(version5, version6);
        }
コード例 #2
0
        public void AdaptiveDialog_GetInternalVersion()
        {
            var ds       = new TestAdaptiveDialog();
            var version1 = ds.GetInternalVersion_Test();

            Assert.IsNotNull(version1);

            var ds2      = new TestAdaptiveDialog();
            var version2 = ds.GetInternalVersion_Test();

            Assert.IsNotNull(version2);
            Assert.AreEqual(version1, version2, "Same configuration should give same version");

            ds2 = new TestAdaptiveDialog()
            {
                Triggers = new List <OnCondition>()
                {
                    new OnIntent("foo")
                    {
                    }
                }
            };

            var version3 = ds2.GetInternalVersion_Test();

            Assert.IsNotNull(version3);
            Assert.AreNotEqual(version2, version3, "version should change if trigger added");

            ds2 = new TestAdaptiveDialog()
            {
                Triggers = new List <OnCondition>()
                {
                    new OnIntent("foo")
                    {
                        Condition = "user.name == 'joe'"
                    }
                }
            };

            var version4 = ds2.GetInternalVersion_Test();

            Assert.IsNotNull(version4);
            Assert.AreNotEqual(version3, version4, "version should change if condition modified");

            var ds3 = new TestAdaptiveDialog()
            {
                Triggers = new List <OnCondition>()
                {
                    new OnIntent("foo")
                    {
                        Condition = "user.name == 'joe'",
                        Actions   = new List <Dialog>()
                        {
                            new SendActivity()
                            {
                                Activity = new ActivityTemplate("yo")
                            }
                        }
                    }
                }
            };

            var version5 = ds3.GetInternalVersion_Test();

            Assert.IsNotNull(version5);
            Assert.AreNotEqual(version4, version5, "version should change if action added ");

            var version6 = ds3.GetInternalVersion_Test();

            Assert.AreEqual(version5, version6, "version should be same if no change");
        }