public void TestUpdateDuplicateParameterOtherSmtp(Enums.ValidDuplicated inputType, OtherParameters param) { var handler = new DefaultManager(); var request = new Dictionary <string, object> { [param.GetEnumStringValue()] = 0, [$"{param.GetEnumStringValue()}_Dup"] = inputType == Enums.ValidDuplicated.SameValue ? 0 : 1 }; var response = handler.Send <object>(param == OtherParameters.AllowUserSpecific ? SmtpSpecificEndPoint : SmtpDefaultEndPoint, JsonConvert.SerializeObject(request).Replace("_Dup", string.Empty), HttpMethod.PUT); PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent)); }
public void TestOtherHttpMethod(HttpMethod inputType, OtherParameters param) { var handler = new DefaultManager(); var request = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(param.GetEnumStringValue(), "0") }; var response = handler.Send <object>(param == OtherParameters.AllowUserSpecific ? SmtpSpecificEndPoint : SmtpDefaultEndPoint, request, inputType); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound)); }
public void TestValidPutOthersSmtpRequestJsonContentType(OtherParameters param) { var handler = new DefaultManager(); var request = new Dictionary <string, object> { [param.GetEnumStringValue()] = 0 }; var response = handler.Send <object>(param == OtherParameters.AllowUserSpecific ? SmtpSpecificEndPoint : SmtpDefaultEndPoint, JsonConvert.SerializeObject(request), HttpMethod.PUT, "text/html"); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }
public void TestValidGetOthersSmtpReturnJsonContentType(OtherParameters param) { var connection = PrivateApiConnection.GetConnectionForCurrentTest(); var request = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(param.GetEnumStringValue(), "0") }; var response = connection.SendAsync(param == OtherParameters.AllowUserSpecific ? SmtpSpecificEndPoint : SmtpDefaultEndPoint, request, System.Net.Http.HttpMethod.Get).Result; PrAssert.That(response.Content.Headers.ContentType.MediaType, PrIs.EqualTo("application/json")); }
public void TestUpdateOtherSmtpAccessEndpoint(OtherParameters param, AccessState accessState, HttpStatusCode httpStatusCode, ResultCode resultCode) { var request = new Dictionary <string, object> { [param.GetEnumStringValue()] = 1 }; AccessEndpointManager accessEndpointHandler = new AccessEndpointManager(); var response = accessEndpointHandler.AccessEndpoint <object>(accessState, param == OtherParameters.AllowUserSpecific ? SmtpSpecificEndPoint : SmtpDefaultEndPoint, request, HttpMethod.Put); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(httpStatusCode).And.ErrorCode((int)resultCode), $"Still able to send a update smtp request."); }