public async void ExecuteGetShouldReturnErrorNotAuthorized() { //Arrange var baseUrl = "http://demo7064886.mockable.io"; var httpHeader = new HTTPHeader() { splitSDKMachineIP = "1.0.0.0", splitSDKMachineName = "localhost", splitSDKVersion = "1", splitSDKSpecVersion = "2" }; var SdkApiClient = new SdkApiClient(httpHeader, baseUrl, 10000, 10000); //Act var result = await SdkApiClient.ExecuteGet("/messages?item=msg2"); //Assert Assert.AreEqual(result.statusCode, HttpStatusCode.Unauthorized); }
public async Task ExecuteGetShouldReturnNotFoundOnInvalidRequest() { //Arrange var baseUrl = "http://demo706abcd.mockable.io"; var headers = new Dictionary <string, string> { { "SplitSDKMachineIP", "1.0.0.0" }, { "SplitSDKMachineName", "localhost" }, { "SplitSDKVersion", "1" } }; var telemetryStorage = new InMemoryTelemetryStorage(); var SdkApiClient = new SdkApiClient("ABCD", headers, baseUrl, 10000, 10000, telemetryStorage); //Act var result = await SdkApiClient.ExecuteGet("/messages?item=msg2"); //Assert Assert.AreEqual(result.statusCode, HttpStatusCode.NotFound); }
public async void ExecuteGetShouldReturnNotFoundOnInvalidRequest() { //Arrange var baseUrl = "http://demo706abcd.mockable.io"; var httpHeader = new HTTPHeader() { authorizationApiKey = "ABCD", splitSDKMachineIP = "1.0.0.0", splitSDKMachineName = "localhost", splitSDKVersion = "1", splitSDKSpecVersion = "2" }; var SdkApiClient = new SdkApiClient(httpHeader, baseUrl, 10000, 10000); //Act var result = await SdkApiClient.ExecuteGet("/messages?item=msg2"); //Assert Assert.AreEqual(result.statusCode, HttpStatusCode.NotFound); }
public async Task ExecuteGetShouldReturnEmptyResponseOnInvalidURL() { //Arrange var baseUrl = "http://demo70e.iio"; var headers = new Dictionary <string, string> { { "SplitSDKMachineIP", "1.0.0.0" }, { "SplitSDKMachineName", "localhost" }, { "SplitSDKVersion", "1" } }; var telemetryStorage = new InMemoryTelemetryStorage(); var SdkApiClient = new SdkApiClient("ABCD", headers, baseUrl, 10000, 10000, telemetryStorage); //Act var result = await SdkApiClient.ExecuteGet("http://demo70e.iio/messages?item=msg2"); //Assert Assert.IsNotNull(result); Assert.IsNull(result.content); }
public async Task ExecuteGetSuccessful() { //Arrange var baseUrl = "http://demo7064886.mockable.io"; var headers = new Dictionary <string, string> { { "SplitSDKMachineIP", "1.0.0.0" }, { "SplitSDKMachineName", "localhost" }, { "SplitSDKVersion", "1" } }; var telemetryStorage = new InMemoryTelemetryStorage(); var SdkApiClient = new SdkApiClient("ABCD", headers, baseUrl, 10000, 10000, telemetryStorage); //Act var result = await SdkApiClient.ExecuteGet("/messages?item=msg1"); //Assert Assert.AreEqual(result.statusCode, HttpStatusCode.OK); Assert.IsTrue(result.content.Contains("Hello World")); }
public async void ExecuteGetSuccessful() { //Arrange var baseUrl = "http://demo7064886.mockable.io"; var httpHeader = new HTTPHeader() { authorizationApiKey = "ABCD", splitSDKMachineIP = "1.0.0.0", splitSDKMachineName = "localhost", splitSDKVersion = "1", splitSDKSpecVersion = "2" }; var SdkApiClient = new SdkApiClient(httpHeader, baseUrl, 10000, 10000); //Act var result = await SdkApiClient.ExecuteGet("/messages?item=msg1"); //Assert Assert.AreEqual(result.statusCode, HttpStatusCode.OK); Assert.IsTrue(result.content.Contains("Hello World")); }
public async Task ExecuteGetShouldReturnEmptyResponseOnInvalidURL() { //Arrange var baseUrl = "http://demo70e.iio"; var httpHeader = new HTTPHeader() { authorizationApiKey = "ABCD", splitSDKMachineIP = "1.0.0.0", splitSDKMachineName = "localhost", splitSDKVersion = "1", splitSDKSpecVersion = "2" }; var SdkApiClient = new SdkApiClient(httpHeader, baseUrl, 10000, 10000); //Act var result = await SdkApiClient.ExecuteGet("/messages?item=msg2"); //Assert Assert.IsNotNull(result); Assert.IsNull(result.content); }