예제 #1
0
 public void MessagesMadeFromSetContainKeyGivenToConstructor(string key)
 {
     Chatbase.FBAgentMessageSet set = new Chatbase.FBAgentMessageSet(key);
     Chatbase.FBAgentMessage    msg = set.NewMessage();
     Assert.Equal(msg.api_key, key);
     set.Add(msg);
     Assert.Equal(set.GetMessages().Count, 1);
 }
예제 #2
0
        public void SendingValidFBAgentMessageSetReturnsSuccess(string intent, string ver, string senderID, string recID, string msgID, string cnt)
        {
            string key = Environment.GetEnvironmentVariable("CB_TEST_API_KEY");

            if (String.IsNullOrEmpty(key))
            {
                ChatbaseClientUnitTests.PrintNoAPIKeyWarning();
            }
            else
            {
                Chatbase.FBAgentMessageSet set = new Chatbase.FBAgentMessageSet(key);
                Chatbase.FBAgentMessage    msg = set.NewMessage();

                msg.SetRecipientID(recID).SetMessageID(msgID).SetMessageContent(cnt);
                msg.intent  = intent;
                msg.version = ver;
                set.Add(msg);
                var resp = _client.Send(set).Result;
                Assert.Equal(resp.StatusCode, HttpStatusCode.OK);
            }
        }