Esempio n. 1
0
        public void postLoginDetails()
        {
            RegisterDetails uRD = new RegisterDetails();

            uRD.email    = "abi@abi";
            uRD.password = "******";

            spRestHttpClient sphc = new spRestHttpClient();

            sphc.baseAddress      = "https://reqres.in/api/";
            sphc.partAddress      = "login";
            sphc.httpClientMethod = httpClientVerbs.POST;
            sphc.resObjStr        = "";
            sphc.postObject       = uRD;
            try
            {
                sphc.runAsyncPost();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            if (sphc.resStatusCode == "OK")
            {
                Console.WriteLine("LoginDetails Test Passed");
                Console.Write(sphc.resObjStr.ToString());
            }
            else
            {
                Console.Write(sphc.resObjStr.ToString());
                throw new Exception("LoginDetails Test Failed");
            }
        }
Esempio n. 2
0
        public void postRegisterDetailsFail()
        {
            RegisterDetails uRD = new RegisterDetails();

            uRD.email = "abi@abi";

            spRestHttpClient sphc = new spRestHttpClient();

            sphc.baseAddress      = "https://reqres.in/api/";
            sphc.partAddress      = "register";
            sphc.httpClientMethod = httpClientVerbs.POST;
            sphc.resObjStr        = "";
            sphc.postObject       = uRD;
            try
            {
                sphc.runAsyncPost();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            if (sphc.resStatusCode == "BadRequest")
            {
                Console.WriteLine("RegisterDetailsFail Test Passed");
            }
            else
            {
                throw new Exception("RegisterDetailsFail Test Failed");
            }
        }