From 9bbc47946310d0e294a57591ddab30df6ff9f15c Mon Sep 17 00:00:00 2001 From: Sik Date: Mon, 5 Aug 2024 22:16:30 +0200 Subject: [PATCH] feat: refractored web tests models --- Web.Test/Models/HttpBinDeleteResponse.cs | 68 +-------------------- Web.Test/Models/HttpBinGetResponse.cs | 56 +---------------- Web.Test/Models/HttpBinPatchResponse.cs | 68 +-------------------- Web.Test/Models/HttpBinPostFileResponse.cs | 59 +----------------- Web.Test/Models/HttpBinPostResponse.cs | 56 +---------------- Web.Test/Models/HttpBinPutResponse.cs | 71 +--------------------- Web.Test/Models/HttpBinResponseBase.cs | 40 ++++++++++++ 7 files changed, 51 insertions(+), 367 deletions(-) create mode 100644 Web.Test/Models/HttpBinResponseBase.cs diff --git a/Web.Test/Models/HttpBinDeleteResponse.cs b/Web.Test/Models/HttpBinDeleteResponse.cs index 34e5517..1fcd3bc 100644 --- a/Web.Test/Models/HttpBinDeleteResponse.cs +++ b/Web.Test/Models/HttpBinDeleteResponse.cs @@ -1,70 +1,6 @@ -using System.Text.Json.Serialization; - -namespace Web.Test.Models +namespace Web.Test.Models { - public class HttpBinDeleteResponse + public class HttpBinDeleteResponse : HttpBinResponseBase { - [JsonPropertyName("args")] - public Dictionary Args { get; set; } - - [JsonPropertyName("data")] - public string Data { get; set; } - - [JsonPropertyName("files")] - public Dictionary Files { get; set; } - - [JsonPropertyName("form")] - public Dictionary Form { get; set; } - - [JsonPropertyName("headers")] - public HttpBinDeleteResponseHeaders Headers { get; set; } - - [JsonPropertyName("json")] - public object Json { get; set; } - - [JsonPropertyName("origin")] - public string Origin { get; set; } - - [JsonPropertyName("url")] - public string Url { get; set; } - } - - public class HttpBinDeleteResponseHeaders - { - [JsonPropertyName("Accept")] - public string Accept { get; set; } - - [JsonPropertyName("Accept-Encoding")] - public string AcceptEncoding { get; set; } - - [JsonPropertyName("Accept-Language")] - public string AcceptLanguage { get; set; } - - [JsonPropertyName("Host")] - public string Host { get; set; } - - [JsonPropertyName("Origin")] - public string Origin { get; set; } - - [JsonPropertyName("Priority")] - public string Priority { get; set; } - - [JsonPropertyName("Referer")] - public string Referer { get; set; } - - [JsonPropertyName("Sec-Fetch-Dest")] - public string SecFetchDest { get; set; } - - [JsonPropertyName("Sec-Fetch-Mode")] - public string SecFetchMode { get; set; } - - [JsonPropertyName("Sec-Fetch-Site")] - public string SecFetchSite { get; set; } - - [JsonPropertyName("User-Agent")] - public string UserAgent { get; set; } - - [JsonPropertyName("X-Amzn-Trace-Id")] - public string AmazonTraceId { get; set; } } } diff --git a/Web.Test/Models/HttpBinGetResponse.cs b/Web.Test/Models/HttpBinGetResponse.cs index 2106865..dede37f 100644 --- a/Web.Test/Models/HttpBinGetResponse.cs +++ b/Web.Test/Models/HttpBinGetResponse.cs @@ -1,58 +1,6 @@ -using System.Text.Json.Serialization; - -namespace Web.Test.Models +namespace Web.Test.Models { - public class HttpBinGetResponse + public class HttpBinGetResponse : HttpBinResponseBase { - [JsonPropertyName("args")] - public Dictionary Args { get; set; } - - [JsonPropertyName("headers")] - public HttpBinGetResponseHeaders Headers { get; set; } - - [JsonPropertyName("origin")] - public string Origin { get; set; } - - [JsonPropertyName("url")] - public string Url { get; set; } - } - - public class HttpBinGetResponseHeaders - { - [JsonPropertyName("Accept")] - public string Accept { get; set; } - - [JsonPropertyName("Accept-Encoding")] - public string AcceptEncoding { get; set; } - - [JsonPropertyName("Accept-Language")] - public string AcceptLanguage { get; set; } - - [JsonPropertyName("Host")] - public string Host { get; set; } - - [JsonPropertyName("Priority")] - public string Priority { get; set; } - - [JsonPropertyName("Sec-Fetch-Dest")] - public string SecFetchDest { get; set; } - - [JsonPropertyName("Sec-Fetch-Mode")] - public string SecFecthMode { get; set; } - - [JsonPropertyName("Sec-Fetch-Site")] - public string SecFetchSite { get; set; } - - [JsonPropertyName("Sec-Fetch-User")] - public string SecFetchUser { get; set; } - - [JsonPropertyName("Upgrade-Insecure-Requests")] - public string UpgradeInsecureRequests { get; set; } - - [JsonPropertyName("User-Agent")] - public string UserAgent { get; set; } - - [JsonPropertyName("X-Amzn-Trace-Id")] - public string AmazonTraceId { get; set; } } } diff --git a/Web.Test/Models/HttpBinPatchResponse.cs b/Web.Test/Models/HttpBinPatchResponse.cs index 9c28084..4e3f542 100644 --- a/Web.Test/Models/HttpBinPatchResponse.cs +++ b/Web.Test/Models/HttpBinPatchResponse.cs @@ -1,70 +1,6 @@ -using System.Text.Json.Serialization; - -namespace Web.Test.Models +namespace Web.Test.Models { - public class HttpBinPatchResponse + public class HttpBinPatchResponse : HttpBinPostResponse { - [JsonPropertyName("args")] - public Dictionary Args { get; set; } - - [JsonPropertyName("data")] - public string Data { get; set; } - - [JsonPropertyName("files")] - public Dictionary Files { get; set; } - - [JsonPropertyName("form")] - public Dictionary Form { get; set; } - - [JsonPropertyName("headers")] - public HttpBinPatchResponseHeaders Headers { get; set; } - - [JsonPropertyName("json")] - public object Json { get; set; } - - [JsonPropertyName("origin")] - public string Origin { get; set; } - - [JsonPropertyName("url")] - public string Url { get; set; } - } - - public class HttpBinPatchResponseHeaders - { - [JsonPropertyName("Accept")] - public string Accept { get; set; } - - [JsonPropertyName("Accept-Encoding")] - public string AcceptEncoding { get; set; } - - [JsonPropertyName("Accept-Language")] - public string AcceptLanguage { get; set; } - - [JsonPropertyName("Host")] - public string Host { get; set; } - - [JsonPropertyName("Origin")] - public string Origin { get; set; } - - [JsonPropertyName("Priority")] - public string Priority { get; set; } - - [JsonPropertyName("Referer")] - public string Referer { get; set; } - - [JsonPropertyName("Sec-Fetch-Dest")] - public string SecFetchDest { get; set; } - - [JsonPropertyName("Sec-Fetch-Mode")] - public string SecFetchMode { get; set; } - - [JsonPropertyName("Sec-Fetch-Site")] - public string SecFetchSite { get; set; } - - [JsonPropertyName("User-Agent")] - public string UserAgent { get; set; } - - [JsonPropertyName("X-Amzn-Trace-Id")] - public string AmazonTraceId { get; set; } } } diff --git a/Web.Test/Models/HttpBinPostFileResponse.cs b/Web.Test/Models/HttpBinPostFileResponse.cs index 17ee724..35c1dbb 100644 --- a/Web.Test/Models/HttpBinPostFileResponse.cs +++ b/Web.Test/Models/HttpBinPostFileResponse.cs @@ -1,61 +1,6 @@ -using System.Text.Json.Serialization; - -namespace Web.Test.Models +namespace Web.Test.Models { - public class HttpBinPostFileResponse + public class HttpBinPostFileResponse : HttpBinPostResponse { - [JsonPropertyName("args")] - public Dictionary Args { get; set; } - - [JsonPropertyName("data")] - public string Data { get; set; } - - [JsonPropertyName("files")] - public Dictionary Files { get; set; } - - [JsonPropertyName("form")] - public Dictionary Form { get; set; } - - [JsonPropertyName("headers")] - public HttpBinPostFileResponseHeaders Headers { get; set; } - - [JsonPropertyName("json")] - public object Json { get; set; } - - [JsonPropertyName("origin")] - public string Origin { get; set; } - - [JsonPropertyName("url")] - public string Url { get; set; } - } - - public class HttpBinPostFileResponseHeaders - { - [JsonPropertyName("Accept")] - public string Accept { get; set; } - - [JsonPropertyName("Accept-Encoding")] - public string AcceptEncoding { get; set; } - - [JsonPropertyName("Cache-Control")] - public string CacheControl { get; set; } - - [JsonPropertyName("Content-Length")] - public string ContentLength { get; set; } - - [JsonPropertyName("Content-Type")] - public string ContentType { get; set; } - - [JsonPropertyName("Host")] - public string Host { get; set; } - - [JsonPropertyName("Postman-Token")] - public string PostmanToken { get; set; } - - [JsonPropertyName("User-Agent")] - public string UserAgent { get; set; } - - [JsonPropertyName("X-Amzn-Trace-Id")] - public string AmazonTraceId { get; set; } } } diff --git a/Web.Test/Models/HttpBinPostResponse.cs b/Web.Test/Models/HttpBinPostResponse.cs index 510e540..fd0ece0 100644 --- a/Web.Test/Models/HttpBinPostResponse.cs +++ b/Web.Test/Models/HttpBinPostResponse.cs @@ -2,11 +2,8 @@ namespace Web.Test.Models { - public class HttpBinPostResponse + public class HttpBinPostResponse : HttpBinResponseBase { - [JsonPropertyName("args")] - public Dictionary Args { get; set; } - [JsonPropertyName("data")] public string Data { get; set; } @@ -16,58 +13,7 @@ public class HttpBinPostResponse [JsonPropertyName("form")] public Dictionary Form { get; set; } - [JsonPropertyName("headers")] - public HttpBinPostResponseHeaders Headers { get; set; } - [JsonPropertyName("json")] public object Json { get; set; } - - [JsonPropertyName("origin")] - public string Origin { get; set; } - - [JsonPropertyName("url")] - public string Url { get; set; } - } - - public class HttpBinPostResponseHeaders - { - [JsonPropertyName("Accept")] - public string Accept { get; set; } - - [JsonPropertyName("Accept-Encoding")] - public string AcceptEncoding { get; set; } - - [JsonPropertyName("Accept-Language")] - public string AcceptLanguage { get; set; } - - [JsonPropertyName("Content-Length")] - public string ContentLength { get; set; } - - [JsonPropertyName("Host")] - public string Host { get; set; } - - [JsonPropertyName("Origin")] - public string Origin { get; set; } - - [JsonPropertyName("Priority")] - public string Priority { get; set; } - - [JsonPropertyName("Referer")] - public string Referer { get; set; } - - [JsonPropertyName("Sec-Fetch-Dest")] - public string SecFetchDest { get; set; } - - [JsonPropertyName("Sec-Fetch-Mode")] - public string SecFetchMode { get; set; } - - [JsonPropertyName("Sec-Fetch-Site")] - public string SecFetchSite { get; set; } - - [JsonPropertyName("User-Agent")] - public string UserAgent { get; set; } - - [JsonPropertyName("X-Amzn-Trace-Id")] - public string AmazonTraceId { get; set; } } } diff --git a/Web.Test/Models/HttpBinPutResponse.cs b/Web.Test/Models/HttpBinPutResponse.cs index 634c5cf..3a3f889 100644 --- a/Web.Test/Models/HttpBinPutResponse.cs +++ b/Web.Test/Models/HttpBinPutResponse.cs @@ -1,73 +1,6 @@ -using System.Text.Json.Serialization; - -namespace Web.Test.Models +namespace Web.Test.Models { - public class HttpBinPutResponse + public class HttpBinPutResponse : HttpBinPostResponse { - [JsonPropertyName("args")] - public Dictionary Args { get; set; } - - [JsonPropertyName("data")] - public string Data { get; set; } - - [JsonPropertyName("files")] - public Dictionary Files { get; set; } - - [JsonPropertyName("form")] - public Dictionary Form { get; set; } - - [JsonPropertyName("headers")] - public HttpBinPutResponseHeaders Headers { get; set; } - - [JsonPropertyName("json")] - public object Json { get; set; } - - [JsonPropertyName("origin")] - public string Origin { get; set; } - - [JsonPropertyName("url")] - public string Url { get; set; } - } - - public class HttpBinPutResponseHeaders - { - [JsonPropertyName("Accept")] - public string Accept { get; set; } - - [JsonPropertyName("Accept-Encoding")] - public string AcceptEncoding { get; set; } - - [JsonPropertyName("Accept-Language")] - public string AcceptLanguage { get; set; } - - [JsonPropertyName("Content-Length")] - public string ContentLength { get; set; } - - [JsonPropertyName("Host")] - public string Host { get; set; } - - [JsonPropertyName("Origin")] - public string Origin { get; set; } - - [JsonPropertyName("Priority")] - public string Priority { get; set; } - - [JsonPropertyName("Referer")] - public string Referer { get; set; } - - [JsonPropertyName("Sec-Fetch-Dest")] - public string SecFetchDest { get; set; } - - [JsonPropertyName("Sec-Fetch-Mode")] - public string SecFetchMode { get; set; } - - [JsonPropertyName("Sec-Fetch-Site")] - public string SecFetchSite { get; set; } - - [JsonPropertyName("User-Agent")] - public string UserAgent { get; set; } - - [JsonPropertyName("X-Amzn-Trace-Id")] - public string AmazonTraceId { get; set; } } } diff --git a/Web.Test/Models/HttpBinResponseBase.cs b/Web.Test/Models/HttpBinResponseBase.cs new file mode 100644 index 0000000..2f930af --- /dev/null +++ b/Web.Test/Models/HttpBinResponseBase.cs @@ -0,0 +1,40 @@ +using System.Text.Json.Serialization; + +namespace Web.Test.Models +{ + public class HttpBinResponseBase + { + [JsonPropertyName("args")] + public Dictionary Args { get; set; } + + [JsonPropertyName("headers")] + public HttpBinResponseHeaders Headers { get; set; } + + [JsonPropertyName("origin")] + public string Origin { get; set; } + + [JsonPropertyName("url")] + public string Url { get; set; } + } + + public class HttpBinResponseHeaders + { + [JsonPropertyName("Accept")] + public string Accept { get; set; } + + [JsonPropertyName("Accept-Encoding")] + public string AcceptEncoding { get; set; } + + [JsonPropertyName("Accept-Language")] + public string AcceptLanguage { get; set; } + + [JsonPropertyName("Host")] + public string Host { get; set; } + + [JsonPropertyName("User-Agent")] + public string UserAgent { get; set; } + + [JsonPropertyName("X-Amzn-Trace-Id")] + public string AmazonTraceId { get; set; } + } +}