コード例 #1
0
        //API Needs fixing, can't resolve on our own
        //[Test()]
        public static void modifyOffer()
        {
            //OfferListCreate.createNewOffer();

            Console.WriteLine (TestGlobals.offerId);

            string query = "/campaign-manager/Offers/" + TestGlobals.offerId;

            Console.WriteLine (query);

            OfferUpdateJSON json = new OfferUpdateJSON ("description", "new offer for QA testing", TestGlobals.offerId, TestGlobals.orgIdWithCampSignedUp, "456", "blah blah blah", true);

            JObject Json = JObject.FromObject(json);

            Console.WriteLine (Json);

            GenericRequest putOffer = new GenericRequest (TestGlobals.campaignServer, query, json);
            Test mTest = new Test (putOffer);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.PUT, client));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine(HTTPSCalls.result.Value);
            Console.WriteLine(HTTPSCalls.result.Key);
            Assert.AreEqual ("200", statusCode);
        }
コード例 #2
0
        public static void orgUpdateHappyPath()
        {
            Console.WriteLine("\norgUpdateHappyPath Test");
            //Setup strings
            string id = TestGlobals.orgIdWithCampSignedUp;

            ConsoleApplication1.OrgUpdateJSON json = new ConsoleApplication1.OrgUpdateJSON();
            json.defaultTermsAndConditions = "Termzan Condit Ions";
            json.id = id;
            json.logoUrl = "http://zombo.com";
            json.name = "ABC Grocery";
            json.privacyPolicy = "stuff";

            GenericRequest request = new GenericRequest(TestGlobals.campaignServer, "/campaign-manager/Organizations/"
                + id, json);

            Test mTest = new Test(request);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.PUT));
            Console.WriteLine(HTTPSCalls.result.ToString());
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value);
            Assert.AreEqual("200", statusCode);
        }
コード例 #3
0
        public static void campaignRedemptionHappyPath()
        {
            //int;
            //<<<<<<< HEAD
            //string orgId = TestGlobals.orgIdWithCampSignedUp;
            //=======
            string orgId = TestGlobals.orgIdCreated;
            //>>>>>>> origin/master
            string timeFilter = TestGlobals.timeFilter;
            string startDate = TestGlobals.startDate;
            string endDate = TestGlobals.endDate;

            //Should be publication ID, not org ID
            string query = "api/dwh/Redemptions?"
            + "orgId=" + orgId + "&"
            + "publicationId="  + TestGlobals.publicationId + "&"
            + "timeFilter=" + timeFilter + "&"
            + "startdate=" + startDate + "&"
            + "enddate=" + endDate;

            GenericRequest request = new GenericRequest(TestGlobals.campaignServer, query, null);

            Console.WriteLine(TestGlobals.campaignServer+query.ToString());

            Test mTest = new Test(request);
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET, client));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);
            Console.WriteLine(HTTPSCalls.result.Value);
            Assert.AreEqual("200", statusCode);
        }
コード例 #4
0
        public static void createSignUpForms()
        {
            /*
            if (TestGlobals.orgIdCreated == null)
            {
                OrganizationTest.createOrganization();
                System.Threading.Thread.Sleep(5000);
            }
            */
            Console.WriteLine("\ncreateSignUpForms Test");
            string query = "/campaign-manager/SignupForms?orgId=" + TestGlobals.orgIdCreated;
            CampaignManagerFormJSON campaign = postSignUpForm(TestGlobals.orgIdCreated);
            GenericRequest postForm = new GenericRequest (TestGlobals.campaignServer, query, campaign);
            Test mTest = new Test (postForm);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();

            if (campaign.fields != null)
            {
                Console.WriteLine(campaign.ToString());
            }
            AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.POST, client));
            string statusCode = HTTPSCalls.result.Key.GetValue ("StatusCode").ToString ();
            Console.WriteLine(statusCode);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value);
            if (statusCode == "201")
            {
                TestGlobals.orgIdWithCampSignedUp = TestGlobals.orgIdCreated;
            }
            Assert.AreEqual ("201", statusCode);
        }
コード例 #5
0
 public void closeSession()
 {
     if (sessionToken != null)
     {
         GenericRequest req = new GenericRequest(TestGlobals.adminServer, "/api/authenticate/", null);
         HttpClient client = new HttpClient();
         client.DefaultRequestHeaders.Authorization = getSessionToken();
         Test closeTest = new Test(req);
         AsyncContext.Run(async () => await new HTTPSCalls().runTest(closeTest, HTTPOperation.DELETE, client));
     }
 }
コード例 #6
0
 //[Test()]
 public void getSingleOrganization()
 {
     string query = "/api/organization/" + TestGlobals.orgIdCreated;
     GenericRequest getOrg = new GenericRequest(TestGlobals.adminServer, query, null);
     Test mTest = new Test(getOrg);
     HttpClient client = new HttpClient();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET, client));
     string statusCode = HTTPSCalls.result.Key.Property ("StatusCode").Value.ToString ();
     Assert.AreEqual("200", statusCode);
     orgStore = HTTPSCalls.result;
 }
コード例 #7
0
 public void getMultipleLocations()
 {
     string query = "/API/Location/?orgid=" + TestGlobals.orgIdCreated;
     GenericRequest getLoc = new GenericRequest(TestGlobals.adminServer, query, null);
     Test mTest = new Test(getLoc);
     HttpClient client = new HttpClient();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET, client));
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Assert.AreEqual("200", statusCode);
     locStore = HTTPCalls.result;
 }
コード例 #8
0
 //[Test()]
 public static void intConfigUpdate()
 {
     string query = "/API/Interceptor/" + TestGlobals.intSerialCreated;
     DeviceStatusPutJSON json = new DeviceStatusPutJSON();
     json.deviceStatus = 1;
     GenericRequest putInt = new GenericRequest (TestGlobals.adminServer, query, json);
     Test mTest = new Test (putInt);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken ();
     AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.PUT, client));
     string statusCode = HTTPSCalls.result.Key.GetValue ("StatusCode").ToString ();
     Assert.AreEqual ("204", statusCode);
 }
コード例 #9
0
 public void getSingleInterceptor()
 {
     string query = "/API/Interceptor/" + TestGlobals.intSerialCreated;
     Console.WriteLine(query);
     GenericRequest getInt = new GenericRequest(TestGlobals.adminServer, query, null);
     Test mTest = new Test(getInt);
     HttpClient client = new HttpClient();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET, client));
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Assert.AreEqual("200", statusCode);
     intStore = HTTPCalls.result;
 }
コード例 #10
0
 public static void displaySignUpForm()
 {
     string query = "/campaign-manager/SignupForms/" + TestGlobals.slug;
     Console.WriteLine (query);
     GenericRequest displayForm = new GenericRequest (TestGlobals.campaignServer, query, null);
     Test mTest = new Test (displayForm);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.GET, client));
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Console.WriteLine(HTTPSCalls.result.Key.ToString());
     Console.WriteLine(HTTPSCalls.result.Value);
     Assert.AreEqual ("200", statusCode);
 }
コード例 #11
0
 public static void getOffers()
 {
     Console.WriteLine("\ngetOffers Test");
     string query = "campaign-manager/Offers?orgId=" + TestGlobals.orgIdWithCampSignedUp;
     GenericRequest getOffers = new GenericRequest (TestGlobals.campaignServer, query, null);
     Test mTest = new Test (getOffers);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.GET, client));
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Console.WriteLine(HTTPSCalls.result.Key);
     Console.WriteLine(HTTPSCalls.result.Value);
     Assert.AreEqual("200", statusCode);
 }
コード例 #12
0
 //[Test()]
 public static void removeOffer()
 {
     Console.WriteLine("\nremoveOffer Test");
     string query = "/campaign-manager/Offers/" + TestGlobals.offerId;
     GenericRequest deleteOffer = new GenericRequest (TestGlobals.campaignServer, query, null);
     Test mTest = new Test (deleteOffer);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.DELETE, client));
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Console.WriteLine(HTTPSCalls.result.Key.ToString());
     Console.WriteLine(HTTPSCalls.result.Value);
     Assert.AreEqual ("204", statusCode);
 }
コード例 #13
0
        public static void listOrgsHappyPath()
        {
            Console.WriteLine("\nlistOrgsHappyPath Test");
            GenericRequest request = new GenericRequest(TestGlobals.campaignServer, "/campaign-manager/Organizations", null);

            Test mTest = new Test(request);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET, client));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value);
            Assert.AreEqual("200", statusCode);
        }
コード例 #14
0
        public void removeInterceptor()
        {
            disableId(TestGlobals.intSerialCreated);

            string query = "/api/interceptor/" + TestGlobals.intSerialCreated;
            GenericRequest intReq = new GenericRequest(TestGlobals.adminServer, query, null);
            Test intTest = new Test(intReq);
            HttpClient client;

            Console.WriteLine(intReq.getUri().ToString());

            client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(intTest, HTTPOperation.DELETE, client));
            Console.WriteLine(HTTPSCalls.result.Value);
        }
コード例 #15
0
 public static void optOut()
 {
     Console.WriteLine("\noptOut Test");
     string query = "/campaign-manager/Signups";//?email=george%40costanza.com&slug="+TestGlobals.slug;
     SignUpJSON signUp = new SignUpJSON ("george%40costanza.com", TestGlobals.slug);
     Console.WriteLine(signUp.ToString());
     GenericRequest deleteSignUp = new GenericRequest (TestGlobals.campaignServer, query, signUp);
     Test mtest = new Test (deleteSignUp);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mtest, HTTPOperation.DELETE, client));
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Console.WriteLine(statusCode);
     Console.WriteLine(HTTPSCalls.result.Key.ToString());
     Console.WriteLine(HTTPSCalls.result.Value.ToString());
     Assert.AreEqual("204", statusCode);
 }
コード例 #16
0
        public static void createNewOffer()
        {
            Console.WriteLine("\ncreateNewOffer Test");
            string query = "campaign-manager/Offers/?orgId=" + TestGlobals.orgIdWithCampSignedUp;
            OfferJSON json = new OfferJSON ("new offer for QA testing", TestGlobals.orgIdWithCampSignedUp, "123", "blah blah blah");
            GenericRequest postOffer = new GenericRequest (TestGlobals.campaignServer, query, json);
            Test mTest = new Test (postOffer);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.POST, client));
            string statusCode = HTTPSCalls.result.Key.GetValue ("StatusCode").ToString ();
            Console.WriteLine(HTTPSCalls.result.Value);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value.Substring(7, 36));

            TestGlobals.offerId = HTTPSCalls.result.Value.Substring (7, 36);
            Assert.AreEqual ("200", statusCode);
        }
コード例 #17
0
 public static void newSignUp()
 {
     Console.WriteLine("\nnewSignUp Test");
     string query = "/campaign-manager/Signups";
     CampaignSignUpJSON campaign = new CampaignSignUpJSON(TestGlobals.slug);
     GenericRequest postSignUp = new GenericRequest (TestGlobals.campaignServer, query, campaign);
     Test mtest = new Test(postSignUp);
     Console.WriteLine(query.ToString());
     Console.WriteLine(campaign.ToString());
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
     AsyncContext.Run(async () => await new HTTPSCalls().runTest(mtest, HTTPOperation.POST, client));
     Console.WriteLine(HTTPSCalls.result.Key);
     Console.WriteLine(HTTPSCalls.result.Value);
     string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
     Console.WriteLine(statusCode);
     Assert.AreEqual ("201", statusCode);
 }
コード例 #18
0
        public static void orgDetailsHappyPath()
        {
            Console.WriteLine("\norgDetailsHappyPath Test");
            //Setup strings
            string id = TestGlobals.orgIdWithCampSignedUp;

            string query = "/campaign-manager/Organizations?id="
                            + id;

            GenericRequest request = new GenericRequest(TestGlobals.campaignServer, query, null);

            Test mTest = new Test(request);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value);
            Assert.AreEqual("200", statusCode);
        }
コード例 #19
0
        public static void createCampaign()
        {
            Console.WriteLine("\ncreateCampaign Test");
            string query = "/campaign-manager/Campaigns?orgId=" + TestGlobals.orgIdWithCampSignedUp;
            Console.WriteLine (query);
            CampaignJSON camp = newCampaign ();
            GenericRequest postCamp = new GenericRequest (TestGlobals.campaignServer, query, camp);
            Test mTest = new Test (postCamp);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run (async () => await new HTTPSCalls ().runTest (mTest, HTTPOperation.POST, client));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);

               	Console.WriteLine("Server: " + TestGlobals.campaignServer);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value);
            Console.WriteLine(camp.ToString());

            Assert.AreEqual ("200", statusCode);
            //Setting global campaign ID to the new campaign created
            TestGlobals.campaignId = HTTPSCalls.result.Value.Substring(7, 36);
        }
コード例 #20
0
        public static void offerPreviewHappyPath()
        {
            Console.WriteLine("\nofferPreviewHappyPath Test");
            //Setup strings
            //Guid;
            string id = TestGlobals.offerId;
            //string
            string campaignName = TestGlobals.campaignName;
            string campaignDescription = TestGlobals.campaignDescription;
            string startDate = TestGlobals.startDate;
            string endDate = TestGlobals.endDate;

            GenericRequest request = new GenericRequest(TestGlobals.campaignServer, "/campaign-manager/Offers/" + id + "/Preview/?campaignName="+campaignName+"&campaignDescription="+campaignDescription+"&startDate="+"&endDate=", null);

            Test mTest = new Test(request);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.GET));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);
            Console.WriteLine(HTTPSCalls.result.Value);
            Console.WriteLine(HTTPSCalls.result.Key);
            Assert.AreEqual("200", statusCode);
        }
コード例 #21
0
        public void removeLocation()
        {
            Console.WriteLine (TestGlobals.locIdCreated);
            string query = "/api/location/" + TestGlobals.locIdCreated;
            GenericRequest locReq = new GenericRequest(TestGlobals.adminServer, query, null);
            Test locTest = new Test(locReq);
            HttpClient client;

            client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(locTest, HTTPOperation.DELETE, client));
            Console.WriteLine(HTTPSCalls.result.Value);
            createLocation ();
            Console.WriteLine (TestGlobals.locIdCreated);
        }
コード例 #22
0
        //[Test()]
        public void userLocAssociated()
        {
            createOrganization ();
            LocationTest.createLoc (TestGlobals.orgIdCreated);

            string query = "/api/organization/" + TestGlobals.orgIdCreated;
            GenericRequest orgReq = new GenericRequest(TestGlobals.adminServer, query, null);
            Test orgTest = new Test(orgReq);
            HttpClient client;

            client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(orgTest, HTTPOperation.DELETE, client));
            string statusCode = HTTPSCalls.result.Key.Property ("StatusCode").Value.ToString ();
            Assert.AreEqual ("400", statusCode);
        }
コード例 #23
0
        public void removeOrganization()
        {
            string query = "/api/organization/" + TestGlobals.orgIdCreated;
            GenericRequest orgReq = new GenericRequest(TestGlobals.adminServer, query, null);
            Test orgTest = new Test(orgReq);
            HttpClient client;

            client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(orgTest, HTTPOperation.DELETE, client));
            Console.WriteLine(HTTPSCalls.result.Value);
            Assert.AreEqual("{\"completedSuccessfully\":true}", HTTPSCalls.result.Value);
        }
コード例 #24
0
        public static void updateCampaign()
        {
            Console.WriteLine("\nupdateCampaign Test");
            Console.WriteLine (TestGlobals.campaignId);

            string query = "/campaign-manager/Campaigns/" + TestGlobals.campaignId;
            Console.WriteLine (query);

            UpdateCampaignJSON camp = updateCampaign(TestGlobals.campaignId);
            GenericRequest updateCamp = new GenericRequest (TestGlobals.campaignServer, query, camp);
            Test mTest = new Test(updateCamp);
            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.PUT, client));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine("Status Code: " + statusCode);
            Console.WriteLine(HTTPSCalls.result.Key.ToString());
            Console.WriteLine(HTTPSCalls.result.Value);
            Assert.AreEqual("200", statusCode);

            removeCampaign ();
        }
コード例 #25
0
        //[Test()]
        public void intAssociated()
        {
            createLocation ();
            InterceptorTest.createInt (TestGlobals.locIdCreated);

            string query = "/api/location/" + TestGlobals.locIdCreated;
            GenericRequest locReq = new GenericRequest (TestGlobals.adminServer, query, null);
            Test locTest = new Test (locReq);
            HttpClient client = new HttpClient ();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken ();
            AsyncContext.Run (async () => await new HTTPSCalls ().runTest (locTest, HTTPOperation.DELETE, client));
            string statusCode = HTTPSCalls.result.Key.GetValue ("StatusCode").ToString ();
            Assert.AreEqual ("400", statusCode);
        }
コード例 #26
0
        private static string idPost()
        {
            string query = "/api/interceptorId/";
            string intSerial = "135792468";
            string intId = "8675308";

            SHA1 sha = new SHA1CryptoServiceProvider();
            byte[] bArray = new byte[25463635];
            byte[] hashedPasswordInBytes = sha.ComputeHash(bArray);
            var stringPassword = string.Concat(hashedPasswordInBytes.Select(b => string.Format("{0:X2}", b)));
            InterceptorIdJSON json = new InterceptorIdJSON ("TESTSERIAL", stringPassword);
            InterceptorIdJSON[] idList = new InterceptorIdJSON[1];
            idList[0] = json;
            JObject jPass = JObject.Parse("{\"idList\":[{\"intId\":\""+intId+"\", \"intSerial\":\""+intSerial+"\", \"key\": \"IEEgQiBQIFIgVSAiIP8=\"},{\"intId\":\"8675309\", \"intSerial\":\"123456789021\", \"key\": \"IEEgQiBQIFIgVSAiIP8=\"}]}");
            GenericRequest newId = new GenericRequest(TestGlobals.adminServer, query, jPass);
            Test mTest = new Test(newId);

            HttpClient client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();

            AsyncContext.Run(async () => await new HTTPSCalls().runTest(mTest, HTTPOperation.POST, client));
            string statusCode = HTTPSCalls.result.Key.GetValue("StatusCode").ToString();
            Console.WriteLine(statusCode);
            Console.WriteLine(HTTPSCalls.result.Value.ToString());
            TestGlobals.intIdCreated = intId;
            TestGlobals.intSerialCreated = intSerial;
            return intId;
        }
コード例 #27
0
        private static void disableId(string id)
        {
            string query = "/api/interceptor/" + id;
            DeviceStatusPutJSON json = new DeviceStatusPutJSON();
            GenericRequest intReq = new GenericRequest(TestGlobals.adminServer, query, json);
            Test intTest = new Test(intReq);
            HttpClient client;

            Console.WriteLine(intReq.getUri().ToString());

            client = new HttpClient();
            client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken();
            AsyncContext.Run(async () => await new HTTPSCalls().runTest(intTest, HTTPOperation.PUT, client));
            Console.WriteLine(HTTPSCalls.result.Value);
        }
コード例 #28
0
 //[Test()]
 public void removingIntNotFound()
 {
     string query = "/api/interceptor/" + "invalidSerial";
     GenericRequest intReq = new GenericRequest (TestGlobals.adminServer, query, null);
     Test intTest = new Test (intReq);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken ();
     AsyncContext.Run (async () => await new HTTPSCalls ().runTest (intTest, HTTPOperation.DELETE, client));
     string statusCode = HTTPSCalls.result.Key.GetValue ("StatusCode").ToString ();
     Assert.AreEqual ("404", statusCode);
     intStore = HTTPSCalls.result;
 }
コード例 #29
0
 //[Test()]
 public void locNotFound()
 {
     string query = "/API/Interceptor/?LocId=" + "invalid";
     GenericRequest getInt = new GenericRequest (TestGlobals.adminServer, query, null);
     Test mTest = new Test (getInt);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken ();
     AsyncContext.Run (async () => await new HTTPSCalls().runTest (mTest, HTTPOperation.GET, client));
     string statusCode = HTTPSCalls.result.Key.GetValue ("StatusCode").ToString ();
     Assert.AreEqual ("404", statusCode);
     intStore = HTTPSCalls.result;
 }
コード例 #30
0
 //[Test()]
 public void removingOrgNotFound()
 {
     string query = "/api/organization/" + "invalidOrg";
     GenericRequest orgReq = new GenericRequest (TestGlobals.adminServer, query, null);
     Test orgTest = new Test (orgReq);
     HttpClient client = new HttpClient ();
     client.DefaultRequestHeaders.Authorization = AuthenticateTest.getSessionToken ();
     AsyncContext.Run(async () => await new HTTPSCalls().runTest(orgTest, HTTPOperation.DELETE, client));
     string statusCode = HTTPSCalls.result.Key.Property ("StatusCode").Value.ToString ();
     Assert.AreEqual ("404", statusCode);
 }