コード例 #1
0
ファイル: CommonSteps.cs プロジェクト: dinvine/EStroreAPITest
        //should get  response status of OK
        public void ThenShouldGetResponseStatusOf(string p0)
        {
            Dictionary <string, string> headerList = FunctionsShared.GetResponseHeaderDict(_settings.MyRestResponse);

            //Console.WriteLine(p0);
            Assert.AreEqual("application/json; charset", headerList["Content-Type"], "Test fail due to the Conten-Type in header is not application json");
            Assert.AreEqual(p0, _settings.MyRestResponse.StatusCode.ToString(), "Test fail due to Response StatusCode is not equal to OK");
        }
コード例 #2
0
ファイル: CommonSteps.cs プロジェクト: dinvine/EStroreAPITest
        //e.g. generate the 'random' username and 'random' password at  'RegisterEndPoint'
        //e.g. generate the 'exsiting' username and 'exsiting' password at  'RegisterEndPoint'

        public void GivenGenerateTheUsernameAndPasswordAt(string p_username, string p_password)
        {
            switch (p_username)
            {
            case "random":
                context["username"] = FunctionsShared.GetRandomString(8);
                break;

            case "empty":
                context["username"] = "";
                break;

            case "existing":
            {
                GivenGenerateTheUsernameAndPasswordAt("random", "random");
                WhenVisitTheRegisterAPIWithTheUsernameAndPassword();
                break;
            }

            default:
                context["username"] = p_username;
                break;
            }
            switch (p_password)
            {
            case "random":
                if (p_username != "existing")
                {
                    context["password"] = FunctionsShared.GetRandomString(8);
                }
                break;

            case "empty":
                context["password"] = "";
                break;

            case "existing":
                break;

            default:
                context["password"] = p_password;
                break;
            }
        }
コード例 #3
0
 public void GivenVisitorHasNotProvideTheUsernameOrPassword()
 {
     userAccount.username = FunctionsShared.getRandomString(8);
     userAccount.password = "";
 }
コード例 #4
0
ファイル: CommonSteps.cs プロジェクト: dinvine/EStroreAPITest
        public void ThenShouldGetResponseComformWithModel(string ResponseSchema)
        {
            Boolean jsonFormatIsValid = FunctionsShared.CompareJsonWithSchema(_settings.MyRestResponse.Content, ResponseSchema);

            Assert.IsTrue(jsonFormatIsValid, "Test failed due to response content did not conform the schema :" + ResponseSchema);
        }
コード例 #5
0
 public void GivenVisitorHasTheUsernameAndPasswordPrepared()
 {
     userAccount.username = FunctionsShared.getRandomString(8);
     userAccount.password = FunctionsShared.getRandomString(8);
 }