public void Complex_Random_With_Conditionals_And_Arrays_Triggers_UTF8()
        {
            var rs = new RiveScript(utf8: true);

            rs.streamForTest(new[] { "! array oi = olá oi",
                                     "^ boa noite|bom dia",
                                     "",
                                     "+ meu nome é *",
                                     "- <set name=<formal>>Prazer em conhecer, <get name>",
                                     "",
                                     "+ @oi",
                                     "* <get name> != undefined => {random}",
                                     "^ Olá, <get name>.|",
                                     "^ Bom dia, <get name>.{/random}",
                                     "- Olá!",
                                     "- Como vai?",
                                    });

            //Without name

            rs.reply("olá")
              .AssertContains("Olá!", "Como vai?");

            //Set name
            rs.reply("meu nome é Fábio")
              .AssertAreEqual("Prazer em conhecer, Fábio");

            rs.reply("bom dia")
               .AssertContains("Olá, Fábio.", "Bom dia, Fábio.");
        }
        public void Complex_Random_With_Conditionals_And_Arrays_Triggers()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "! array hello = hi hello",
                                     "^ hi there | good day",
                                     "",
                                     "+ my name is *",
                                     "- <set name=<formal>>Nice to meet you, <get name>",
                                     "",
                                     "+ @hello",
                                     "* <get name> != undefined => {random}",
                                     "^ Hello there, <get name>.|",
                                     "^ Hey, <get name>.{/random}",
                                     "- Hello there!",
                                     "- Hi there",
                                    });

            //Without name

            rs.reply("hello")
              .AssertContains("Hello there!", "Hi there");

            //Set name
            rs.reply("my name is John")
              .AssertAreEqual("Nice to meet you, John");

            rs.reply("hi")
               .AssertContains("Hello there, John.", "Hey, John.");
        }
Exemple #3
0
        public void Complex_Random_With_Conditionals_And_Arrays_Triggers_UTF8()
        {
            var rs = new RiveScript(utf8: true);

            rs.streamForTest(new[] { "! array oi = olá oi",
                                     "^ boa noite|bom dia",
                                     "",
                                     "+ meu nome é *",
                                     "- <set name=<formal>>Prazer em conhecer, <get name>",
                                     "",
                                     "+ @oi",
                                     "* <get name> != undefined => {random}",
                                     "^ Olá, <get name>.|",
                                     "^ Bom dia, <get name>.{/random}",
                                     "- Olá!",
                                     "- Como vai?", });

            //Without name

            rs.reply("olá")
            .AssertContains("Olá!", "Como vai?");

            //Set name
            rs.reply("meu nome é Fábio")
            .AssertAreEqual("Prazer em conhecer, Fábio");


            rs.reply("bom dia")
            .AssertContains("Olá, Fábio.", "Bom dia, Fábio.");
        }
Exemple #4
0
        public void Complex_Random_With_Conditionals()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ my name is *",
                                     "- <set name=<formal>>Nice to meet you, <get name>",
                                     "",
                                     "+ hello bot",
                                     "* <get name> != undefined => {random}",
                                     "^ Hello there, <get name>.|",
                                     "^ Hey, <get name>.{/random}",
                                     "- Hello there!",
                                     "- Hi there", });

            //Without name

            rs.reply("hello bot")
            .AssertContains("Hello there!", "Hi there");

            //Set name
            rs.reply("my name is John")
            .AssertAreEqual("Nice to meet you, John");


            rs.reply("hello bot")
            .AssertContains("Hello there, John.", "Hey, John.");
        }
        public void Simple_Reply()
        {
            var rs = new RiveScript(utf8: true, debug: true);

            rs.streamForTest(new[] { "+ olá bot",
                                     "- Olá humano!" });

            var reply = rs.reply("default", "olá bot");

            Assert.AreEqual(reply, "Olá humano!");
        }
Exemple #6
0
        public void Simple_Reply()
        {
            var rs = new RiveScript(utf8: true, debug: true);

            rs.streamForTest(new[] { "+ olá bot",
                                     "- Olá humano!" });

            var reply = rs.reply("default", "olá bot");

            Assert.AreEqual(reply, "Olá humano!");
        }
Exemple #7
0
        public void Simple_Random_Word_End()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- Good {random}day|night{/random}" });

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Good day",
                                  "Good night" }.Contains(reply));
        }
Exemple #8
0
        public void Simple_Random_Word_Middle()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- Hello {random}good|best{/random} day" });

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Hello good day",
                                  "Hello best day" }.Contains(reply));
        }
Exemple #9
0
        public void Simple_Random_Word_Start()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- {random}Good|Best{/random} day" });

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Good day",
                                  "Best day" }.Contains(reply));
        }
        public void Simple_Random_Reply()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- Hello",
                                     "- Hi" });

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Hello",
                                  "Hi" }.Contains(reply));
        }
Exemple #11
0
        public void Simple_Random_Reply()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- Hello",
                                     "- Hi" });

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Hello",
                                  "Hi" }.Contains(reply));
        }
Exemple #12
0
        public void Simple_Random_Reply_Alternative_Syntax()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- {random}Hello|Hi|Hello human{/random}" });

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Hello",
                                  "Hi",
                                  "Hello human" }.Contains(reply));
        }
Exemple #13
0
        public void Last_Input_Repetition_UTF8()
        {
            var rs = new RiveScript(utf8: true);

            rs.streamForTest(new[] { "+ <input>",
                                     "- Você não acabou de falar isso?",
                                     "+ olá",
                                     "- Oi" });

            rs.reply("Olá")
            .AssertAreEqual("Oi");

            rs.reply("Olá")
            .AssertAreEqual("Você não acabou de falar isso?");
        }
Exemple #14
0
        public void Last_Input_Repetition()
        {
            var rs = new RiveScript(utf8: false);

            rs.streamForTest(new[] { "+ <input>",
                                     "- Didn't you just say that?",
                                     "+ hi",
                                     "- Hello" });

            rs.reply("Hi")
            .AssertAreEqual("Hello");

            rs.reply("Hi")
            .AssertAreEqual("Didn't you just say that?");
        }
Exemple #15
0
        public void Last_Reply_Repetition_UTF8()
        {
            var rs = new RiveScript(utf8: true);

            rs.streamForTest(new[] { "+ <reply>",
                                     "- Eu não acabei de falar isso?",
                                     "+ olá",
                                     "- Olá como vai" });

            var r1 = rs.reply("Olá");

            Assert.AreEqual("Olá como vai", r1);

            rs.reply("Olá como vai")
            .AssertAreEqual("Eu não acabei de falar isso?");
        }
Exemple #16
0
        public void Last_Reply_Repetition()
        {
            var rs = new RiveScript(utf8: false);

            rs.streamForTest(new[] { "+ <reply>",
                                     "- I just say that",
                                     "+ hi",
                                     "- hello" });

            var r1 = rs.reply("hi");

            Assert.AreEqual("hello", r1);

            rs.reply("hello")
            .AssertAreEqual("I just say that");
        }
        public void Last_Input_Repetition_UTF8()
        {
            var rs = new RiveScript(utf8: true);

            rs.streamForTest(new[] { "+ <input>",
                                     "- Você não acabou de falar isso?",
                                     "+ olá",
                                     "- Oi"

            });

            rs.reply("Olá")
              .AssertAreEqual("Oi");

            rs.reply("Olá")
              .AssertAreEqual("Você não acabou de falar isso?");
        }
        public void Last_Reply_Repetition()
        {
            var rs = new RiveScript(utf8: false);

            rs.streamForTest(new[] { "+ <reply>",
                                     "- I just say that",
                                     "+ hi",
                                     "- hello"

            });

            var r1 = rs.reply("hi");
            Assert.AreEqual("hello", r1);

            rs.reply("hello")
              .AssertAreEqual("I just say that");
        }
        public void Last_Input_Repetition()
        {
            var rs = new RiveScript(utf8: false);

            rs.streamForTest(new[] { "+ <input>",
                                     "- Didn't you just say that?",
                                     "+ hi",
                                     "- Hello"

            });

            rs.reply("Hi")
              .AssertAreEqual("Hello");

            rs.reply("Hi")
              .AssertAreEqual("Didn't you just say that?");
        }
        public void Last_Reply_Repetition_UTF8()
        {
            var rs = new RiveScript(utf8: true);

            rs.streamForTest(new[] { "+ <reply>",
                                     "- Eu não acabei de falar isso?",
                                     "+ olá",
                                     "- Olá como vai"

            });

            var r1 = rs.reply("Olá");
            Assert.AreEqual("Olá como vai", r1);

            rs.reply("Olá como vai")
              .AssertAreEqual("Eu não acabei de falar isso?");
        }
        public void Simple_Random_Word_End()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- Good {random}day|night{/random}"});

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Good day",
                                  "Good night" }.Contains(reply));
        }
        public void Simple_Random_Word_Middle()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- Hello {random}good|best{/random} day"});

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Hello good day",
                                  "Hello best day" }.Contains(reply));
        }
        public void Simple_Random_Reply_Alternative_Syntax()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- {random}Hello|Hi|Hello human{/random}"});

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Hello",
                                  "Hi",
                                  "Hello human" }.Contains(reply));
        }
        public void Simple_Random_Word_Start()
        {
            var rs = new RiveScript();

            rs.streamForTest(new[] { "+ hello bot",
                                     "- {random}Good|Best{/random} day"});

            var reply = rs.reply("hello bot");

            Assert.IsTrue(new[] { "Good day",
                                  "Best day" }.Contains(reply));
        }