Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            try
            {
                using (var host = new WitsHost(6666, WitsLevel.Level0,
                                               new WitsPostProcessorSimple[]
                {
                    new WitsPostProcessorSimple((sentences) =>
                    {
                        foreach (var sentence in sentences)
                        {
                            Console.WriteLine(sentence);
                        }
                    })
                }))
                {
                    host.Start();

                    Pause();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }
        }
Exemplo n.º 2
0
        public void SendWitsSentence()
        {
            var          baseSent       = WitsHelpers.CreateDefaultWitsSentence();
            WitsSentence sentenceResult = null;

            using (var host = new WitsHost(6666, WitsLevel.Level0,
                                           new WitsPostProcessorSimple[]
            {
                new WitsPostProcessorSimple((sentences) =>
                {
                    sentenceResult = sentences.First();
                })
            }))
            {
                host.Start();

                using (var client = new WitsClient("127.0.0.1", 6666))
                {
                    client.Connect();
                    client.SendWitsSentence(baseSent);
                    Thread.Sleep(2000);
                }
            }

            Assert.AreEqual(baseSent.ToString(), sentenceResult.ToString());
        }