//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"); }
//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; } }
public void GivenVisitorHasNotProvideTheUsernameOrPassword() { userAccount.username = FunctionsShared.getRandomString(8); userAccount.password = ""; }
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); }
public void GivenVisitorHasTheUsernameAndPasswordPrepared() { userAccount.username = FunctionsShared.getRandomString(8); userAccount.password = FunctionsShared.getRandomString(8); }