예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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"));
        }
예제 #6
0
        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"));
        }
예제 #7
0
        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);
        }