Beispiel #1
0
        public void Partner2MsdEdifactAPITest()
        {
            #region call Logic app


            string baseUrl    = "https://prod-02.eastasia.logic.azure.com:443/";
            string requestUrl = "/workflows/2a6c49422313438b812644ee305dace3/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Qs6js5QZp-ACntSyHdGgBBlnlPS36GJJf5lIe8pcepA";

            string jsonString = TestData.partner2msdEdifactJsonString;
            Dictionary <string, string> logicAppRequestHeader = new Dictionary <string, string>();

            logicAppRequestHeader.Add("Message-Id", "1");
            logicAppRequestHeader.Add("AS2-TO", "662424795MSDT");
            logicAppRequestHeader.Add("AS2-FROM", "ZZT657257051WIH");
            logicAppRequestHeader.Add("Accept-Encoding", "gzip,deflate");
            logicAppRequestHeader.Add("Disposition-Notification-To", "localhost");

            string mediaType      = "text/plain";
            var    responseResult = CommonMethod.PostResource(baseUrl, requestUrl, jsonString, logicAppRequestHeader, mediaType);
            Assert.AreEqual(responseResult.StatusCode, System.Net.HttpStatusCode.OK);

            //to call msd system.
            string msdBaseUrl      = "https://apim-test-api-au.azure-api.net/";
            string msdrequestUrl   = "/echo/partner2msdEdifact";
            string subscriptionkey = "0aa02a70a75f479d88d73e6e3c011a91";
            string msdJsonString   = TestData.msdEdifactString;
            Dictionary <string, string> msdAppRequestHeader = new Dictionary <string, string>();
            msdAppRequestHeader.Add("ocp-apim-subscription-key", "0aa02a70a75f479d88d73e6e3c011a91");
            var responseResult1 = CommonMethod.PostResource(msdBaseUrl, msdrequestUrl, msdJsonString, msdAppRequestHeader);
            Assert.AreEqual(responseResult.StatusCode, System.Net.HttpStatusCode.OK);

            #endregion

            #region get cache value
            string msdRequestUrl   = "/echo/resource?param1=sample";
            string cacheKey        = "parner2msdEdifact1";
            var    responseResult2 = CommonMethod.GetResource(msdBaseUrl, msdRequestUrl, subscriptionkey, cacheKey);
            Assert.AreNotSame("non-data", responseResult2);

            #endregion


            #region test case
            if (responseResult2 != "non-data")
            {
                //JObject inPutBody = JObject.Parse(TestData.partner2msdJsonJsonString);
                JObject outPutBody = JObject.Parse(responseResult2);
            }
            #endregion
        }
Beispiel #2
0
        public void Msd2PartnerJsonTest()
        {
            #region call Logic app

            string baseUrl    = "https://prod-19.eastasia.logic.azure.com:443/";
            string requestUrl = "/workflows/2cbfde6f37ce46b0bda464513fc578c2/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=vRt6YR5hx5Z0yg7zLYy8S9mGARwjfZxyVPALbWFcYAQ";

            string jsonString = TestData.msd2partnerforJsonJsonString;
            Dictionary <string, string> requestHeader = new Dictionary <string, string>();
            var responseResult = CommonMethod.PostResource(baseUrl, requestUrl, jsonString, requestHeader);
            Assert.AreEqual(responseResult.StatusCode, System.Net.HttpStatusCode.OK);

            //to call msd system.
            string msdBaseUrl    = " https://apim-test-api-au.azure-api.net/";
            string msdrequestUrl = "/echo/msd2partnerforjson";
            Dictionary <string, string> partnerRequestHeader = new Dictionary <string, string>();
            partnerRequestHeader.Add("ocp-apim-subscription-key", "0aa02a70a75f479d88d73e6e3c011a91");
            partnerRequestHeader.Add("Message-ID", "SECC2");

            string msdJsonString = TestData.outPutmsd2partforJsonString;

            var responseResult1 = CommonMethod.PostResource(msdBaseUrl, msdrequestUrl, msdJsonString, partnerRequestHeader);
            Assert.AreEqual(responseResult.StatusCode, System.Net.HttpStatusCode.OK);

            #endregion

            //#region get cache value
            string msdRequestUrl   = "/echo/resource?param1=sample";
            string cacheKey        = "msd2partnerSECC2";
            string subscriptionkey = "0aa02a70a75f479d88d73e6e3c011a91";
            var    responseResult2 = CommonMethod.GetResource(msdBaseUrl, msdRequestUrl, subscriptionkey, cacheKey);
            Assert.AreNotSame("non-data", responseResult2);

            //#endregion


            //#region test case
            ////if (responseResult2 != "non-data")
            ////{
            ////    JObject inPutBody = JObject.Parse(TestData.partner2msdJsonJsonString);
            ////    JObject outPutBody = JObject.Parse(responseResult2);

            ////}
            //#endregion
        }
Beispiel #3
0
        public void Partner2MsdJsonAPiTest()
        {
            #region call Logic app

            string baseUrl    = "https://prod-21.eastasia.logic.azure.com:443/";
            string requestUrl = "/workflows/603f285bd3934dc68e003327c01144a9/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=y2N8tP0npFHNbEIiBlrCgnvlmIjTUBS7GqCrKTNvF0s";

            string jsonString = TestData.partner2msdJsonJsonString;
            Dictionary <string, string> requestHeader = new Dictionary <string, string>();
            var responseResult = CommonMethod.PostResource(baseUrl, requestUrl, jsonString, requestHeader);
            Assert.AreEqual(responseResult.StatusCode, System.Net.HttpStatusCode.OK);

            //to call msd system.
            string msdBaseUrl    = " https://apim-test-api-au.azure-api.net/";
            string msdrequestUrl = "/echo/partner2msdJson";

            string subscriptionkey = "0aa02a70a75f479d88d73e6e3c011a91";
            string msdJsonString   = TestData.msdJsonString;
            Dictionary <string, string> msdRequestHeader = new Dictionary <string, string>();
            msdRequestHeader.Add("ocp-apim-subscription-key", "0aa02a70a75f479d88d73e6e3c011a91");
            var responseResult1 = CommonMethod.PostResource(msdBaseUrl, msdrequestUrl, msdJsonString, msdRequestHeader);
            Assert.AreEqual(responseResult.StatusCode, System.Net.HttpStatusCode.OK);

            #endregion

            #region get cache value
            string msdRequestUrl   = "/echo/resource?param1=sample";
            string cacheKey        = "parner2msdjson1247286586";
            var    responseResult2 = CommonMethod.GetResource(msdBaseUrl, msdRequestUrl, subscriptionkey, cacheKey);
            Assert.AreNotSame("non-data", responseResult2);

            #endregion

            #region test case
            if (responseResult2 != "non-data")
            {
                JObject inPutBody  = JObject.Parse(TestData.partner2msdJsonJsonString);
                JObject outPutBody = JObject.Parse(responseResult2);
            }
            #endregion
        }