Skip to content

Commit

Permalink
Removed const used in JsonPropertyAttribute, removed debug change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy Monk committed Sep 29, 2018
1 parent 966f7d4 commit 0f9afea
Show file tree
Hide file tree
Showing 53 changed files with 188 additions and 271 deletions.
3 changes: 1 addition & 2 deletions lib/PuppeteerSharp.Tests/InputTests/InputTests.cs
Expand Up @@ -89,8 +89,7 @@ public async Task ShouldClickWrappedLinks()
public async Task ShouldClickOnCheckboxInputAndToggle()
{
await Page.GoToAsync(TestConstants.ServerUrl + "/input/checkbox.html");
var foo = await Page.EvaluateExpressionAsync("result.check");
Assert.Null(foo);
Assert.Null(await Page.EvaluateExpressionAsync("result.check"));
await Page.ClickAsync("input#agree");
Assert.True(await Page.EvaluateExpressionAsync<bool>("result.check"));
Assert.Equal(new[] {
Expand Down
8 changes: 4 additions & 4 deletions lib/PuppeteerSharp/BoundingBox.cs
Expand Up @@ -13,25 +13,25 @@ public class BoundingBox : IEquatable<BoundingBox>
/// The x coordinate of the element in pixels.
/// </summary>
/// <value>The x.</value>
[JsonProperty(Constants.X)]
[JsonProperty("x")]
public decimal X { get; set; }
/// <summary>
/// The y coordinate of the element in pixels.
/// </summary>
/// <value>The y.</value>
[JsonProperty(Constants.Y)]
[JsonProperty("y")]
public decimal Y { get; set; }
/// <summary>
/// The width of the element in pixels.
/// </summary>
/// <value>The width.</value>
[JsonProperty(Constants.WIDTH)]
[JsonProperty("width")]
public decimal Width { get; set; }
/// <summary>
/// The height of the element in pixels.
/// </summary>
/// <value>The height.</value>
[JsonProperty(Constants.HEIGHT)]
[JsonProperty("height")]
public decimal Height { get; set; }

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Browser.cs
Expand Up @@ -219,7 +219,7 @@ public async Task<Page[]> PagesAsync()
/// </remarks>
public async Task<string> GetVersionAsync()
{
var version = await Connection.SendAsync("Browser.getVersion").ConfigureAwait(false);
var version = await Connection.SendAsync("Browser.getVersion").ConfigureAwait(false);
return version[Constants.PRODUCT].AsString();
}

Expand Down
86 changes: 2 additions & 84 deletions lib/PuppeteerSharp/Constants.cs
Expand Up @@ -17,7 +17,6 @@ internal class Constants
public const string CONTEXT = "context";
public const string REFERER = "referer";
public const string ACCEPT = "accept";
public const string COOKIE = "cookie";
public const string COOKIES = "cookies";
public const string PROMPT_TEXT = "promptText";
public const string ENUMERABLE = "enumerable";
Expand All @@ -34,7 +33,6 @@ internal class Constants
public const string UNSERIALIZABLE_VALUE = "unserializableValue";
public const string PRODUCT = "product";
public const string USER_AGENT = "userAgent";
public const string NODE = "node";
public const string FRAME = "frame";
public const string PARENT_ID = "parentId";
public const string URL = "url";
Expand All @@ -44,98 +42,16 @@ internal class Constants
public const string CONTENT_SIZE = "contentSize";
public const string WIDTH = "width";
public const string HEIGHT = "height";
public const string X = "x";
public const string Y = "y";
public const string SCALE = "scale";
public const string ANGLE = "angle";
public const string FRAME_ID = "frameId";
public const string EXECUTION_CONTEXT_ID = "executionContextId";
public const string PAYLOAD = "payload";
public const string ARGS = "args";
public const string SEQ = "seq";
public const string MODEL = "model";
public const string CONTENT = "content";
public const string PADDING = "padding";
public const string BORDER = "border";
public const string MARGIN = "margin";
public const string EVENT_ID = "eventId";
public const string START_OFFSET = "startOffset";
public const string END_OFFSET = "endOffset";
public const string COUNT = "count";
public const string STYLE_SHEET_ID = "styleSheetId";
public const string BROWSER_CONTEXT_ID = "browserContextId";
public const string BROWSER_CONTEXT_IDS = "browserContextIds";
public const string RULE_USAGE = "ruleUsage";
public const string USED = "used";
public const string HEADER = "header";
public const string SOURCE_URL = "sourceURL";
public const string SCRIPT_ID = "scriptId";
public const string QUADS = "quads";
public const string LAYOUT_VIEWPORT = "layoutViewport";
public const string PAGE_X = "pageX";
public const string PAGE_Y = "pageY";
public const string EOF = "eof";
public const string LOADER_ID = "loaderId";
public const string REQUEST_ID = "requestId";
public const string ERROR_TEXT = "errorText";
public const string ENTRY = "entry";
public const string SOURCE = "source";
public const string LEVEL = "level";
public const string BODY = "body";
public const string BASE_64_ENCODED = "base64Encoded";
public const string CURRENT_INDEX = "currentIndex";
public const string ENTRIES = "entries";
public const string DEFAULT_PROMPT = "defaultPrompt";
public const string METRICS = "metrics";
public const string TITLE = "title";
public const string FUNCTIONS = "functions";
public const string RANGES = "ranges";
public const string INTERCEPTION_ID = "interceptionId";
public const string REQUEST = "request";
public const string RESOURCE_TYPE = "resourceType";
public const string IS_NAVIGATION_REQUEST = "isNavigationRequest";
public const string RESPONSE_HEADERS = "responseHeaders";
public const string RESPONSE_STATUS_CODE = "responseStatusCode";
public const string REDIRECT_URL = "redirectURL";
public const string AUTH_CHALLENGE = "authChallenge";
public const string ORIGIN = "origin";
public const string SCHEME = "scheme";
public const string REALM = "realm";
public const string REDIRECT_RESPONSE = "redirectResponse";
public const string HEADERS = "headers";
public const string STATUS = "status";
public const string SECURITY_DETAILS = "securityDetails";
public const string FROM_DISK_CACHE = "fromDiskCache";
public const string FROM_SERVICE_WORKER = "fromServiceWorker";
public const string RESPONSE = "response";
public const string TARGET_INFO = "targetInfo";
public const string AUX_DATA = "auxData";
public const string IS_DEFAULT = "isDefault";
public const string DOMAIN = "domain";
public const string PATH = "path";
public const string EXPIRES = "expires";
public const string SIZE = "size";
public const string HTTP_ONLY = "httpOnly";
public const string SECURE = "secure";
public const string SESSION = "session";
public const string EXCEPTION = "exception";
public const string STACK_TRACE = "stackTrace";
public const string DESCRIPTION = "description";
public const string CALL_FRAMES = "callFrames";
public const string COLUMN_NUMBER = "columnNumber";
public const string LINE_NUMBER = "lineNumber";
public const string FUNCTION_NAME = "functionName";
public const string POST_DATA = "postData";
public const string CLIP = "clip";
public const string FULL_PAGE = "fullPage";
public const string OMIT_BACKGROUND = "omitBackground";
public const string QUALITY = "quality";
public const string SUBJECT_NAME = "subjectName";
public const string ISSUER = "issuer";
public const string VALID_FROM = "validFrom";
public const string VALID_TO = "validTo";
public const string PROTOCOL = "protocol";
public const string OPENER_ID = "openerId";
public const string MODIFIERS = "modifiers";
public const string WINDOWS_VIRTUAL_KEY_CODE = "windowsVirtualKeyCode";
public const string CODE = "code";
Expand All @@ -156,5 +72,7 @@ internal class Constants
public const string ACTION = "action";
public const string RAW_RESPONSE = "rawResponse";
public const string ERROR_REASON = "errorReason";
public const string X = "x";
public const string Y = "y";
}
}
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/ContextPayload.cs
Expand Up @@ -4,9 +4,9 @@ namespace PuppeteerSharp
{
internal class ContextPayload
{
[JsonProperty(Constants.ID)]
[JsonProperty("id")]
internal int Id { get; set; }
[JsonProperty(Constants.AUX_DATA)]
[JsonProperty("auxData")]
internal ContextPayloadAuxData AuxData { get; set; }
}
}
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/ContextPayloadAuxData.cs
Expand Up @@ -4,9 +4,9 @@ namespace PuppeteerSharp
{
internal class ContextPayloadAuxData
{
[JsonProperty(Constants.FRAME_ID)]
[JsonProperty("frameId")]
internal string FrameId { get; set; }
[JsonProperty(Constants.IS_DEFAULT)]
[JsonProperty("isDefault")]
internal bool IsDefault { get; set; }
}
}
20 changes: 10 additions & 10 deletions lib/PuppeteerSharp/CookieParam.cs
Expand Up @@ -14,61 +14,61 @@ public class CookieParam
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[JsonProperty(Constants.NAME)]
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
[JsonProperty(Constants.VALUE)]
[JsonProperty("value")]
public string Value { get; set; }
/// <summary>
/// Gets or sets the domain.
/// </summary>
/// <value>The domain.</value>
[JsonProperty(Constants.DOMAIN, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("domain", NullValueHandling = NullValueHandling.Ignore)]
public string Domain { get; set; }
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
[JsonProperty(Constants.URL, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("url", NullValueHandling = NullValueHandling.Ignore)]
public string Url { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
[JsonProperty(Constants.PATH, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)]
public string Path { get; set; }
/// <summary>
/// Gets or sets the expiration.
/// </summary>
/// <value>Expiration.</value>
[JsonProperty(Constants.EXPIRES, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("expires", NullValueHandling = NullValueHandling.Ignore)]
public double? Expires { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>The size.</value>
[JsonProperty(Constants.SIZE, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("size", NullValueHandling = NullValueHandling.Ignore)]
public int? Size { get; set; }
/// <summary>
/// Gets or sets if it's HTTP only.
/// </summary>
/// <value>Whether it's http only or not.</value>
[JsonProperty(Constants.HTTP_ONLY, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("httpOnly", NullValueHandling = NullValueHandling.Ignore)]
public bool? HttpOnly { get; set; }
/// <summary>
/// Gets or sets if it's secure.
/// </summary>
/// <value>Whether it's secure or not.</value>
[JsonProperty(Constants.SECURE, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("secure", NullValueHandling = NullValueHandling.Ignore)]
public bool? Secure { get; set; }
/// <summary>
/// Gets or sets if it's session only.
/// </summary>
/// <value>Whether it's session only or not.</value>
[JsonProperty(Constants.SESSION, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("session", NullValueHandling = NullValueHandling.Ignore)]
public bool? Session { get; set; }
}
}
6 changes: 3 additions & 3 deletions lib/PuppeteerSharp/EvaluateExceptionDetails.cs
Expand Up @@ -4,11 +4,11 @@ namespace PuppeteerSharp
{
internal class EvaluateExceptionDetails
{
[JsonProperty(Constants.EXCEPTION)]
[JsonProperty("exception")]
internal EvaluateExceptionInfo Exception { get; set; }
[JsonProperty(Constants.TEXT)]
[JsonProperty("text")]
internal string Text { get; set; }
[JsonProperty(Constants.STACK_TRACE)]
[JsonProperty("stackTrace")]
internal EvaluateExceptionStackTrace StackTrace { get; set; }
}
}
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/EvaluateExceptionInfo.cs
Expand Up @@ -4,10 +4,10 @@ namespace PuppeteerSharp
{
internal class EvaluateExceptionInfo
{
[JsonProperty(Constants.DESCRIPTION)]
[JsonProperty("description")]
internal string Description { get; set; }

[JsonProperty(Constants.VALUE)]
[JsonProperty("value")]
internal string Value { get; set; }
}
}
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/EvaluateExceptionStackTrace.cs
Expand Up @@ -5,7 +5,7 @@ namespace PuppeteerSharp
{
internal class EvaluateExceptionStackTrace
{
[JsonProperty(Constants.CALL_FRAMES)]
[JsonProperty("callFrames")]
internal EvaluationExceptionCallFrame[] CallFrames { get; set; }
}
}
8 changes: 4 additions & 4 deletions lib/PuppeteerSharp/EvaluationExceptionCallFrame.cs
Expand Up @@ -4,13 +4,13 @@ namespace PuppeteerSharp
{
internal class EvaluationExceptionCallFrame
{
[JsonProperty(Constants.COLUMN_NUMBER)]
[JsonProperty("columnNumber")]
internal int ColumnNumber { get; set; }
[JsonProperty(Constants.LINE_NUMBER)]
[JsonProperty("lineNumber")]
internal int LineNumber { get; set; }
[JsonProperty(Constants.URL)]
[JsonProperty("url")]
internal string Url { get; set; }
[JsonProperty(Constants.FUNCTION_NAME)]
[JsonProperty("functionName")]
internal string FunctionName { get; set; }
}
}
8 changes: 4 additions & 4 deletions lib/PuppeteerSharp/FramePayload.cs
Expand Up @@ -4,13 +4,13 @@ namespace PuppeteerSharp
{
internal class FramePayload
{
[JsonProperty(Constants.ID)]
[JsonProperty("id")]
internal string Id { get; set; }
[JsonProperty(Constants.PARENT_ID)]
[JsonProperty("parentId")]
internal string ParentId { get; set; }
[JsonProperty(Constants.NAME)]
[JsonProperty("name")]
internal string Name { get; set; }
[JsonProperty(Constants.URL)]
[JsonProperty("url")]
internal string Url { get; set; }
}
}
10 changes: 5 additions & 5 deletions lib/PuppeteerSharp/Media/Clip.cs
Expand Up @@ -14,31 +14,31 @@ public class Clip
/// x-coordinate of top-left corner of clip area.
/// </summary>
/// <value>The x.</value>
[JsonProperty(Constants.X)]
[JsonProperty("x")]
public decimal X { get; set; }
/// <summary>
/// y-coordinate of top-left corner of clip area.
/// </summary>
/// <value>The y.</value>
[JsonProperty(Constants.Y)]
[JsonProperty("y")]
public decimal Y { get; set; }
/// <summary>
/// Width of clipping area.
/// </summary>
/// <value>The width.</value>
[JsonProperty(Constants.WIDTH)]
[JsonProperty("width")]
public decimal Width { get; set; }
/// <summary>
/// Height of clipping area.
/// </summary>
/// <value>The height.</value>
[JsonProperty(Constants.HEIGHT)]
[JsonProperty("height")]
public decimal Height { get; set; }
/// <summary>
/// Scale of the webpage rendering. Defaults to 1.
/// </summary>
/// <value>The scale.</value>
[JsonProperty(Constants.SCALE)]
[JsonProperty("scale")]
public int Scale { get; internal set; }

internal Clip Clone()
Expand Down
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/Media/ScreenOrientation.cs
Expand Up @@ -4,9 +4,9 @@ namespace PuppeteerSharp.Media
{
internal class ScreenOrientation
{
[JsonProperty(Constants.ANGLE)]
[JsonProperty("angle")]
public int Angle { get; internal set; }
[JsonProperty(Constants.TYPE)]
[JsonProperty("type")]
public string Type { get; internal set; }
}
}

0 comments on commit 0f9afea

Please sign in to comment.