public void WritingPasswordSettingsInvalidSpecialContent(Common.InvalidSpecialCondition invalidSpecialCondition) { var handler = new WebPasswordManager(); var response = handler.Password <object>(Common.InvalidEntrySpecialTestCasesMapper[invalidSpecialCondition], System.Net.Http.HttpMethod.Put); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.BadRequest)); }
public void ReadingPasswordSettings(Common.InvalidValue invalidCompany) { var request = Common.InvalidReadingMapper[invalidCompany](new Dictionary <string, string>(), "id"); var handler = new WebPasswordManager(); var response = handler.Password <PasswordSettingsResponse>(request, System.Net.Http.HttpMethod.Get); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.BadRequest)); }
public void ReadingPasswordSettingsInvalidMethod(HttpMethod httpMethod) { var request = new Dictionary <string, string>() { ["id"] = Common.OldCompanyId.ToString(), }; var handler = new WebPasswordManager(); var response = handler.Password <PasswordSettingsResponse>(request, Common.HttpMethodMapper[httpMethod]); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.MethodNotAllowed)); }
public void ReadingPasswordSettingsInjection(Common.InjectionInput injectionInput) { var request = new Dictionary <string, string>() { ["id"] = Common.InjectionInputMapper[injectionInput], }; var handler = new WebPasswordManager(); var response = handler.Password <PasswordSettingsResponse>(request, System.Net.Http.HttpMethod.Get); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.BadRequest)); }
public void TestReadWebPasswordAccessEndpoint(AccessState accessState, HttpStatusCode httpStatusCode, ResultCode resultCode) { var request = new Dictionary <string, string>() { ["id"] = Common.OldCompanyId.ToString(), }; var handler = new WebPasswordManager(); var response = handler.Password <PasswordSettingsResponse>(Common.OldCompanyId, System.Net.Http.HttpMethod.Get); PrAssert.That(response, PrIs.ErrorResponse()); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(httpStatusCode).And.ContainsError(((int)resultCode).ToString()), "Still able to access merge api."); }
public void WritingPasswordSettingsInvalidMethod(HttpMethod httpMethod) { var request = new Dictionary <string, object>() { ["companyId"] = Common.OldCompanyId.ToString(), ["minLength"] = Common.DefaultMinLength, ["checkComplexity"] = false, }; var handler = new WebPasswordManager(); var response = handler.Password <object>(request, Common.HttpMethodMapper[httpMethod]); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.MethodNotAllowed)); }
public void WritingPasswordSettingsInvalidMinLength(Common.InvalidValue invalidMinlength) { var validRequest = new Dictionary <string, object>() { ["companyId"] = Common.OldCompanyId.ToString(), ["minLength"] = Common.DefaultMinLength, ["checkComplexity"] = false, }; var request = Common.InvalidNumberMapper[invalidMinlength](validRequest, "minLength"); var handler = new WebPasswordManager(); var response = handler.Password <object>(request, System.Net.Http.HttpMethod.Put); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.BadRequest)); }
public void TestWriteWebPasswordAccessEndpoint(AccessState accessState, HttpStatusCode httpStatusCode, ResultCode resultCode) { var request = new Dictionary <string, object>() { ["companyId"] = Common.OldCompanyId, ["minLength"] = 8, ["checkComplexity"] = true, }; var handler = new WebPasswordManager(); var response = handler.Password <object>(request, System.Net.Http.HttpMethod.Put); PrAssert.That(response, PrIs.ErrorResponse()); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(httpStatusCode).And.ContainsError(((int)resultCode).ToString()), "Still able to access merge api."); }
public void WritingPasswordSettingsInvalidFieldInjection(string field, Common.InjectionInput injectionInput) { var request = new Dictionary <string, object>() { ["companyId"] = Common.OldCompanyId.ToString(), ["minLength"] = Common.DefaultMinLength, ["checkComplexity"] = false, }; request[field] = Common.InjectionInputMapper[injectionInput]; var handler = new WebPasswordManager(); var response = handler.Password <object>(request, System.Net.Http.HttpMethod.Put); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(HttpStatusCode.BadRequest)); }
public void WritingPasswordSettings(int companyId, Common.ValidNumber validNumberMinLength, bool validCheckComplexity, Common.OptionalParam optionalParam, Common.ValidNumber validNumberOption) { var request = new Dictionary <string, object>() { ["companyId"] = companyId, ["minLength"] = Common.mapNumber[validNumberMinLength], ["checkComplexity"] = validCheckComplexity, }; Common.ValidNumberMapper[optionalParam](request, Common.mapNumber[validNumberOption]); var handler = new WebPasswordManager(); var response = handler.Password <object>(request, System.Net.Http.HttpMethod.Put); PrAssert.That(response, PrIs.SuccessfulResponse()); PrAssert.That(response.HttpStatusCode, PrIs.EqualTo(System.Net.HttpStatusCode.NoContent), "The status code is not as expected!"); }
public void ReadingPasswordSettings(int companyId) { var request = new Dictionary <string, string>() { ["id"] = companyId.ToString(), }; var handler = new WebPasswordManager(); var response = handler.Password <PasswordSettingsResponse>(request, System.Net.Http.HttpMethod.Get); PrAssert.That(response, PrIs.SuccessfulResponse()); if (companyId == Common.OldCompanyId) { PrAssert.That(response.Result.CheckComplexity, PrIs.EqualTo(false), "The check complexity is not as expected"); } else { PrAssert.That(response.Result.CheckComplexity, PrIs.EqualTo(true), "The check complexity is not as expected"); PrAssert.That(response.Result.AccountLockOut.MaxFails, PrIs.EqualTo(5), "The max fails is not as expected"); PrAssert.That(response.Result.History.Count, PrIs.EqualTo(3), "The count is not as expected"); PrAssert.That(response.Result.Expiration.Days, PrIs.EqualTo(90), "The days is not as expected"); } }