public void Model_VersionGlobals_GetCombinedVersion_Should_Pass() { var Actual = VersionGlobals.GetCombinedVersion(); string Expected = "Version: " + VersionGlobals.GetCodeVersion() + " Data: " + VersionGlobals.GetDataVersion(); Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public async Task <string> GetJsonPostAsync(HttpClient myHttpClient, string RestUrl, JObject jsonString) { // Take the post paramaters, and add the Version and Device to it if (string.IsNullOrEmpty(RestUrl)) { return(null); } //// Add the Account Authorization Information to it var dict = new Dictionary <string, string> { { "Version", VersionGlobals.GetCodeVersion() }, }; JObject finalContentJson = (JObject)JToken.FromObject(dict); var finalJson = new JObject(); if (jsonString != null) { finalJson = jsonString; } finalJson.Merge(finalContentJson, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Union }); var finalPostString = finalJson.ToString(); var HeaderContent = new StringContent(finalPostString, Encoding.UTF8, "application/json"); // If a client is passed in, use it if (myHttpClient != null) { this.SetHttpClient(myHttpClient); } HttpResponseMessage response; try { response = await _httpClient.PostAsync(RestUrl, HeaderContent); if (!response.IsSuccessStatusCode) { return(null); } } catch (Exception ex) { Console.Out.WriteLine(ex.ToString()); return(null); } var data = await JsonParseResult(response); return(data); }
public void Model_VersionGlobals_GetDataVersion_Should_Pass() { var Actual = VersionGlobals.GetDataVersion(); Assert.AreNotEqual(null, Actual, TestContext.CurrentContext.Test.Name); }