public void SettingPlatformOnClientSetsOnMessageFromParams(string plt) { Chatbase.Client cl = new Chatbase.Client(); cl.platform = plt; Chatbase.Message msg = cl.NewMessageFromClientParams(); Assert.Equal(msg.platform, plt); // Make sure all other unset fields were not affected Assert.True(String.IsNullOrEmpty(msg.api_key)); Assert.True(String.IsNullOrEmpty(msg.user_id)); Assert.True(String.IsNullOrEmpty(msg.version)); }
public void SettringClientPropsSetsOnMessageFromParams(string key, string uid, string plt, string ver) { Chatbase.Client cl = new Chatbase.Client(); cl.api_key = key; cl.user_id = uid; cl.platform = plt; cl.version = ver; Chatbase.Message msg = cl.NewMessageFromClientParams(); Assert.Equal(msg.api_key, key); Assert.Equal(msg.user_id, uid); Assert.Equal(msg.platform, plt); Assert.Equal(msg.version, ver); }
public void SendingFromClientReturnsSuccess(string uid, string plt, string ver) { string key = Environment.GetEnvironmentVariable("CB_TEST_API_KEY"); Chatbase.Message msg = new Chatbase.Message(); if (String.IsNullOrEmpty(key)) { ChatbaseClientUnitTests.PrintNoAPIKeyWarning(); } else { Chatbase.Client cl = new Chatbase.Client(); cl.user_id = uid; cl.platform = plt; cl.version = ver; cl.api_key = key; var resp = _client.Send(cl.NewMessageFromClientParams()).Result; Assert.Equal(resp.StatusCode, HttpStatusCode.OK); } }
public ChatbaseClientUnitTests() { _client = new Chatbase.Client(); }