本文整理汇总了C#中ResponseStatus类的典型用法代码示例。如果您正苦于以下问题:C# ResponseStatus类的具体用法?C# ResponseStatus怎么用?C# ResponseStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResponseStatus类属于命名空间,在下文中一共展示了ResponseStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResponseBuilder
public ResponseBuilder([NotNull] JsonResponses jsonResponses, ResponseStatus status)
{
this.jsonResponses = jsonResponses;
this.status = status;
message = string.Empty;
links = new List<Link>();
}
示例2: JsonResponse
public JsonResponse(string sessionId, ResponseStatus responseCode, object value)
{
this.SessionId = sessionId;
this.Status = responseCode;
this.Value = responseCode == ResponseStatus.Success ? value : this.PrepareErrorResponse(value);
}
示例3: Receive
public void Receive()
{
Reader = new BinaryReader(Connection.GetNetworkStream());
var reader = Reader;
Status = (ResponseStatus)reader.ReadByte();
SessionId = reader.ReadInt32EndianAware();
if (Status == ResponseStatus.ERROR)
{
string exceptionString = "";
byte followByte = reader.ReadByte();
while (followByte == 1)
{
int exceptionClassLength = reader.ReadInt32EndianAware();
exceptionString += System.Text.Encoding.Default.GetString(reader.ReadBytes(exceptionClassLength)) + ": ";
int exceptionMessageLength = reader.ReadInt32EndianAware();
// don't read exception message string if it's null
if (exceptionMessageLength != -1)
{
exceptionString += System.Text.Encoding.Default.GetString(reader.ReadBytes(exceptionMessageLength)) + "\n";
}
followByte = reader.ReadByte();
}
if (OClient.ProtocolVersion >= 19) {
int serializedVersionLength = reader.ReadInt32EndianAware();
var buffer = reader.ReadBytes(serializedVersionLength);
}
throw new OException(OExceptionType.Operation, exceptionString);
}
}
示例4: StatusElse
public void StatusElse(ResponseStatus status)
{
var response = new SagePay.Response.RefundResponse();
response.Status = status;
Assert.False(response.IsValid());
}
示例5: DecodeResponse
public void DecodeResponse(StreamReader xmlResponse)
{
_ResponseStatus = new ResponseStatus();
_ResponseData = new DataFields();
string xmlData = xmlResponse.ReadToEnd();
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(xmlData);
XmlNodeList nodeList = xmlDocument.SelectNodes("/response");
foreach (XmlNode xmlNode in nodeList[0].ChildNodes)
{
switch (xmlNode.Name)
{
case "status":
_ResponseStatus.Code = xmlNode.InnerText;
_ResponseStatus.Text = getResponseText(xmlNode.InnerText);
break;
case "token":
_ResponseStatus.Token = xmlNode.InnerText;
break;
case "error":
_ResponseStatus.Error = xmlNode.InnerText;
break;
case "data":
_ResponseData = NodeToDataFields(xmlNode.ChildNodes);
break;
default:
break;
}
}
}
示例6: ServiceResponse
/// <summary>
/// Constructor with parameters.
/// </summary>
/// <param name="version">The API version of the response.</param>
/// <param name="status">The response status.</param>
public ServiceResponse(string version, ResponseStatus status)
: base()
{
this.Version = version;
this.Status = status.ToString();
this.EndPoint = this.ResolveEndpoint();
}
示例7: AddErrorMessage
public void AddErrorMessage(string errorMessage, bool setStatusToFailed = true)
{
_errorMessages.Add(errorMessage);
if (setStatusToFailed)
{
_responseStatus = ResponseStatus.Failure;
}
}
示例8: ResponseJson
public ResponseJson(ResponseStatus status)
{
this.status = status;
data = "{}";
message = "";
time = DateTime.Now;
remark = "";
}
示例9: Parse
public virtual void Parse(
ResponseStatus responseStatus,
ArraySegment<byte> bodyData,
ArraySegment<byte> extras,
ArraySegment<byte> key,
int bytesOfBodyPreviouslyRead,
int totalBodyLength)
{
}
示例10: Log
public void Log(ResponseStatus responseStatus, string resourceUrl)
{
Console.WriteLine("Console and file loger URL: {1} | Status: {0}", responseStatus, resourceUrl);
using (var stWr = new StreamWriter(@"../log.txt",true))
{
var sb = new StringBuilder(String.Format("{0} | {1} | {2}", DateTime.Now.ToString(), resourceUrl, responseStatus));
stWr.WriteLine(sb);
}
}
示例11: GetDetailUrl
/// <summary>
/// Gets the URL for the Response detail page of a given Response instance.
/// </summary>
/// <param name="eventId">The event ID.</param>
/// <param name="eventStart">The date for which this response was made.</param>
/// <param name="status">The status.</param>
/// <param name="count">The number of Responses for this event and status.</param>
/// <returns>
/// A URL for the Response detail page of a given Response instance
/// </returns>
private string GetDetailUrl(int eventId, DateTime eventStart, ResponseStatus status, int count)
{
return count > 0
? this.BuildLinkUrl(
this.ModuleId,
"ResponseDetail",
Utility.GetEventParameters(eventId, eventStart, "status=" + status))
: string.Empty;
}
示例12: JsonResponse
protected string JsonResponse(ResponseStatus status, object value)
{
if (status != ResponseStatus.Success && value == null)
{
value = string.Format("WebDriverException {0}", Enum.GetName(typeof(ResponseStatus), status));
}
return JsonConvert.SerializeObject(new JsonResponse(this.Session, status, value));
}
示例13: PingResult
public PingResult(int pingResultId, int statusCode, string statusDescription, string server, Uri responseUri, ResponseStatus responseStatus, DateTime dateCreated)
{
this.PingResultId = pingResultId;
this.StatusCode = statusCode;
this.StatusDescription = statusDescription;
this.Server = server;
this.ResponseUri = responseUri.ToString();
this.ResponseStatus = responseStatus.ToString();
this.DateCreated = dateCreated;
}
示例14: SetupIRestClientMock
public static Mock<IRestClient> SetupIRestClientMock(ResponseStatus responsesStatus, string filename)
{
var moqRestClient = new Mock<IRestClient>();
moqRestClient.Setup(x => x.Execute(It.Is<IRestRequest>
(p => p.Parameters.Exists(y => y.Name == "user")
&& p.Parameters.Exists(y => y.Name == "file")
&& p.Parameters.Exists(y => y.Value == "matt")
&& p.Parameters.Exists(y => y.Value == filename))
))
.Returns(new RestResponse() { ResponseStatus = responsesStatus });
return moqRestClient;
}
示例15: Can_serialize_ResponseStats
public void Can_serialize_ResponseStats()
{
var dto = new ResponseStatus {
ErrorCode = null
};
var dtoString = TypeSerializer.SerializeToString(dto);
Assert.That(dtoString, Is.EqualTo("{Errors:[]}"));
Console.WriteLine(dtoString);
}