Merge branch 'feature/v3' into client-models
This commit is contained in:
Коммит
1356bf6efb
|
@ -107,7 +107,7 @@ namespace AutoRest.TestServer.Tests
|
|||
{
|
||||
foreach (var expectedStub in _expectedCoverage)
|
||||
{
|
||||
if (!matched.Contains(expectedStub))
|
||||
if (!matched.Contains(expectedStub, StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
throw new InvalidOperationException($"Expected stub {expectedStub} was not matched, matched: {string.Join(Environment.NewLine, matched)}");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core.Pipeline;
|
||||
|
@ -15,19 +18,61 @@ namespace AutoRest.TestServer.Tests
|
|||
public class TestServerTestBase
|
||||
{
|
||||
private readonly TestServerVersion _version;
|
||||
private readonly string? _coverageFile;
|
||||
public static ClientDiagnostics ClientDiagnostics = new ClientDiagnostics(new TestOptions());
|
||||
|
||||
public TestServerTestBase(TestServerVersion version)
|
||||
public TestServerTestBase(TestServerVersion version): this(version, null)
|
||||
{
|
||||
}
|
||||
|
||||
public TestServerTestBase(TestServerVersion version, string? coverageFile)
|
||||
{
|
||||
_version = version;
|
||||
_coverageFile = coverageFile;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefinesAllScenarios()
|
||||
{
|
||||
if (_coverageFile != null)
|
||||
{
|
||||
var scenarios = TestServerV1.GetScenariosForRoute(_coverageFile);
|
||||
var methods = this.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance).Select(m => m.Name)
|
||||
.ToArray();
|
||||
|
||||
|
||||
List<string> missingScenarios = new List<string>();
|
||||
foreach (string scenario in scenarios)
|
||||
{
|
||||
if (!methods.Contains(scenario, StringComparer.CurrentCultureIgnoreCase))
|
||||
{
|
||||
missingScenarios.Add(scenario);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingScenarios.Any())
|
||||
{
|
||||
Assert.Fail("Expected scenarios " + string.Join(Environment.NewLine, missingScenarios) + " not defined");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Task TestStatus(Func<string, HttpPipeline, Task<Response>> test)
|
||||
{
|
||||
return TestStatus(TestContext.CurrentContext.Test.Name, test);
|
||||
}
|
||||
|
||||
public Task TestStatus(string scenario, Func<string, HttpPipeline, Task<Response>> test) => Test(scenario, async (host, pipeline) =>
|
||||
{
|
||||
var response = await test(host, pipeline);
|
||||
Assert.AreEqual(200, response.Status);
|
||||
Assert.AreEqual(200, response.Status, "Unexpected response " + response.ReasonPhrase);
|
||||
});
|
||||
|
||||
public Task Test(Func<string, HttpPipeline, Task> test)
|
||||
{
|
||||
return Test(TestContext.CurrentContext.Test.Name, test);
|
||||
}
|
||||
|
||||
public async Task Test(string scenario, Func<string, HttpPipeline, Task> test)
|
||||
{
|
||||
var server = TestServerSession.Start(_version, scenario);
|
||||
|
|
|
@ -5,25 +5,26 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class TestServerV1 : IDisposable, ITestServer
|
||||
{
|
||||
private Process _process;
|
||||
private List<string> _lines = new List<string>();
|
||||
private static Regex _scenariosRegex = new Regex("(coverage|optionalCoverage)\\[(\"|')(?<name>\\w+)(\"|')\\]", RegexOptions.Compiled);
|
||||
|
||||
private Process _process;
|
||||
public HttpClient Client { get; }
|
||||
public string Host { get; }
|
||||
|
||||
public TestServerV1()
|
||||
{
|
||||
var portPhrase = "Server started at port ";
|
||||
var nodeModules = TestServerV2.FindNodeModulesDirectory();
|
||||
var startup = Path.Combine(nodeModules, "@microsoft.azure", "autorest.testserver", "startup", "www.js");
|
||||
var startup = Path.Combine(GetBaseDirectory(), "startup", "www.js");
|
||||
|
||||
var processStartInfo = new ProcessStartInfo("node", startup);
|
||||
|
||||
|
@ -58,6 +59,25 @@ namespace AutoRest.TestServer.Tests
|
|||
|
||||
}
|
||||
|
||||
public static string[] GetScenariosForRoute(string name)
|
||||
{
|
||||
var scenarios = _scenariosRegex.Matches(File.ReadAllText(Path.Combine(GetBaseDirectory(), "routes", name + ".js")))
|
||||
.Select(m => m.Groups["name"].Value).ToArray();
|
||||
|
||||
if (!scenarios.Any())
|
||||
{
|
||||
throw new InvalidOperationException("No scenarios found");
|
||||
}
|
||||
|
||||
return scenarios;
|
||||
}
|
||||
|
||||
private static string GetBaseDirectory()
|
||||
{
|
||||
var nodeModules = TestServerV2.FindNodeModulesDirectory();
|
||||
return Path.Combine(nodeModules, "@microsoft.azure", "autorest.testserver");
|
||||
}
|
||||
|
||||
private void ReadOutput()
|
||||
{
|
||||
while (!_process.HasExited && !_process.StandardOutput.EndOfStream)
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using body_string;
|
||||
using body_string.Models.V100;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class BodyStringEnumTest : TestServerTestBase
|
||||
{
|
||||
public BodyStringEnumTest(TestServerVersion version) : base(version) { }
|
||||
|
||||
[Test]
|
||||
public Task GetNotExpandable() => Test("getEnumNotExpandable", async (host, pipeline) =>
|
||||
{
|
||||
var result = await EnumOperations.GetNotExpandableAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(Colors.RedColor, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutNotExpandable() => TestStatus("putEnumNotExpandable", async (host, pipeline) =>
|
||||
await EnumOperations.PutNotExpandableAsync(ClientDiagnostics, pipeline, Colors.RedColor, host));
|
||||
}
|
||||
}
|
|
@ -3,23 +3,61 @@
|
|||
|
||||
using System.Threading.Tasks;
|
||||
using body_string;
|
||||
using body_string.Models.V100;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class BodyStringTest : TestServerTestBase
|
||||
{
|
||||
public BodyStringTest(TestServerVersion version) : base(version) { }
|
||||
public BodyStringTest(TestServerVersion version) : base(version, "string") { }
|
||||
|
||||
[Test]
|
||||
public Task GetMbcs() => Test("getStringMultiByteCharacters", async (host, pipeline) =>
|
||||
public Task GetStringMultiByteCharacters() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetMbcsAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutMbcs() => Test("putStringMultiByteCharacters", async (host, pipeline) =>
|
||||
[Ignore("deserializer fails")]
|
||||
public Task GetStringNotProvided() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetNotProvidedAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("base64 not implemented")]
|
||||
public Task GetStringNullBase64UrlEncoding() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetNullBase64UrlEncodedAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(null, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("base64 not implemented")]
|
||||
public Task GetStringBase64Encoded() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetBase64EncodedAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("a string that gets encoded with base64", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("base64 not implemented")]
|
||||
public Task GetStringBase64UrlEncoded() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetBase64UrlEncodedAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("a string that gets encoded with base64", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("base64 not implemented")]
|
||||
public Task PutStringBase64UrlEncoded() => TestStatus(async (host, pipeline) =>
|
||||
await StringOperations.PutBase64UrlEncodedAsync(ClientDiagnostics, pipeline, new byte[0], host));
|
||||
|
||||
[Test]
|
||||
public Task PutStringMultiByteCharacters() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.PutMbcsAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(200, result.Status);
|
||||
|
@ -27,7 +65,7 @@ namespace AutoRest.TestServer.Tests
|
|||
|
||||
[Test]
|
||||
[Ignore("Deserializer fails")]
|
||||
public Task GetNull() => Test("string_null", async (host, pipeline) =>
|
||||
public Task GetStringNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetNullAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(null, result.Value);
|
||||
|
@ -35,35 +73,43 @@ namespace AutoRest.TestServer.Tests
|
|||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V1, "returns 400")]
|
||||
public Task PutNull() => Test("string_null", async (host, pipeline) =>
|
||||
public Task string_null1() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.PutNullAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(200, result.Status);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetEmpty() => Test("getStringEmpty", async (host, pipeline) =>
|
||||
public Task GetStringEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutEmpty() => Test("putStringEmpty", async (host, pipeline) =>
|
||||
public Task PutStringEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.PutEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(200, result.Status);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetWhitespace() => Test("getStringWithLeadingAndTrailingWhitespace", async (host, pipeline) =>
|
||||
[IgnoreOnTestServer(TestServerVersion.V1, "Test server aborts the connection")]
|
||||
public Task PutStringNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.PutNullAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(200, result.Status);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetStringWithLeadingAndTrailingWhitespace() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetWhitespaceAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(" Now is the time for all good men to come to the aid of their country ", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutWhitespace() => Test("putStringWithLeadingAndTrailingWhitespace", async (host, pipeline) =>
|
||||
public Task PutStringWithLeadingAndTrailingWhitespace() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.PutWhitespaceAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(200, result.Status);
|
||||
|
@ -71,10 +117,44 @@ namespace AutoRest.TestServer.Tests
|
|||
|
||||
[Test]
|
||||
[Ignore("Deserializer fails")]
|
||||
public Task GetNotProvided() => Test("string_notprovided", async (host, pipeline) =>
|
||||
public Task GetNotProvided() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await StringOperations.GetNotProvidedAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("", result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetEnumReferenced() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await EnumOperations.GetReferencedAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(Colors.RedColor, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetEnumReferencedConstant() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await EnumOperations.GetReferencedConstantAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual("Sample String", result.Value.Field1);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetEnumNotExpandable() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await EnumOperations.GetNotExpandableAsync(ClientDiagnostics, pipeline, host);
|
||||
Assert.AreEqual(Colors.RedColor, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutEnumReferenced() => TestStatus(async (host, pipeline) =>
|
||||
await EnumOperations.PutReferencedAsync(ClientDiagnostics, pipeline, Colors.RedColor, host));
|
||||
|
||||
[Test]
|
||||
[Ignore("Model not generated correctly")]
|
||||
public Task PutEnumReferencedConstant() => TestStatus(async (host, pipeline) =>
|
||||
await EnumOperations.PutReferencedConstantAsync(ClientDiagnostics, pipeline, new RefColorConstant(), host));
|
||||
|
||||
[Test]
|
||||
public Task PutEnumNotExpandable() => TestStatus(async (host, pipeline) =>
|
||||
await EnumOperations.PutNotExpandableAsync(ClientDiagnostics, pipeline, Colors.RedColor, host));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,17 +2,20 @@
|
|||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using custom_baseUrl;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class custom_baseURL : TestServerTestBase
|
||||
{
|
||||
public custom_baseURL(TestServerVersion version) : base(version) { }
|
||||
public custom_baseURL(TestServerVersion version) : base(version, "customUri") { }
|
||||
|
||||
[Test]
|
||||
public Task GetEmpty() => TestStatus("CustomBaseUri", async (host, pipeline) =>
|
||||
await PathsOperations.GetEmptyAsync(ClientDiagnostics, pipeline, string.Empty, host.Replace("http://", string.Empty)));
|
||||
public Task CustomBaseUri() => TestStatus(async (host, pipeline) =>
|
||||
await custom_baseUrl.PathsOperations.GetEmptyAsync(ClientDiagnostics, pipeline, string.Empty, host.Replace("http://", string.Empty)));
|
||||
|
||||
[Test]
|
||||
public Task CustomBaseUriMoreOptions() => TestStatus(async (host, pipeline) =>
|
||||
await global::custom_baseUrl_more_options.PathsOperations.GetEmptyAsync(ClientDiagnostics, pipeline, vault: host, string.Empty, "key1", "test12", "v1", dnsSuffix: string.Empty));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using custom_baseUrl_more_options;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class custom_baseUrl_more_options : TestServerTestBase
|
||||
{
|
||||
public custom_baseUrl_more_options(TestServerVersion version) : base(version) { }
|
||||
|
||||
[Test]
|
||||
public Task GetEmpty() => TestStatus("CustomBaseUriMoreOptions", async (host, pipeline) =>
|
||||
await PathsOperations.GetEmptyAsync(ClientDiagnostics, pipeline, vault: host, string.Empty, "key1", "test12", "v1", dnsSuffix: string.Empty));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using header;
|
||||
using header.Models.V100;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "Too many missing or too strict recordings")]
|
||||
public class HeaderTests : TestServerTestBase
|
||||
{
|
||||
public HeaderTests(TestServerVersion version) : base(version, "header") { }
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterExistingKey() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamExistingKeyAsync(ClientDiagnostics, pipeline, "overwrite", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseExistingKey() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseExistingKeyAsync(ClientDiagnostics, pipeline, host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("Azure.Core doesn't send Content-Type without having some content")]
|
||||
public Task HeaderParameterProtectedKey() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamProtectedKeyAsync(ClientDiagnostics, pipeline, "text/html", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseProtectedKey() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseProtectedKeyAsync(ClientDiagnostics, pipeline, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterIntegerNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamIntegerAsync(ClientDiagnostics, pipeline, scenario: "negative", -2, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterIntegerPositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamIntegerAsync(ClientDiagnostics, pipeline, scenario: "positive", 1, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseIntegerPositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseIntegerAsync(ClientDiagnostics, pipeline, scenario: "positive", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseIntegerNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseIntegerAsync(ClientDiagnostics, pipeline, scenario: "negative", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterLongPositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamLongAsync(ClientDiagnostics, pipeline, scenario: "positive", 105, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterLongNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamLongAsync(ClientDiagnostics, pipeline, scenario: "negative", -2, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseLongPositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseLongAsync(ClientDiagnostics, pipeline, scenario: "positive", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseLongNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseLongAsync(ClientDiagnostics, pipeline, scenario: "negative", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterFloatPositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamFloatAsync(ClientDiagnostics, pipeline, scenario: "positive", 0.07, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterFloatNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamFloatAsync(ClientDiagnostics, pipeline, scenario: "negative", -3, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseFloatPositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseFloatAsync(ClientDiagnostics, pipeline, scenario: "positive", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseFloatNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseFloatAsync(ClientDiagnostics, pipeline, scenario: "negative", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterDoublePositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDoubleAsync(ClientDiagnostics, pipeline, scenario: "positive", 7e120, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterDoubleNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDoubleAsync(ClientDiagnostics, pipeline, scenario: "negative", -3.0, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDoublePositive() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDoubleAsync(ClientDiagnostics, pipeline, scenario: "positive", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDoubleNegative() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDoubleAsync(ClientDiagnostics, pipeline, scenario: "negative", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("bool.ToString() has wrong casing")]
|
||||
public Task HeaderParameterBoolFalse() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamBoolAsync(ClientDiagnostics, pipeline, scenario: "false", false, host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("bool.ToString() has wrong casing")]
|
||||
public Task HeaderParameterBoolTrue() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamBoolAsync(ClientDiagnostics, pipeline, scenario: "true", true, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseBoolTrue() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseBoolAsync(ClientDiagnostics, pipeline, scenario: "true", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseBoolFalse() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseBoolAsync(ClientDiagnostics, pipeline, scenario: "false", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterStringValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamStringAsync(ClientDiagnostics, pipeline, scenario: "valid", "The quick brown fox jumps over the lazy dog", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterStringEmpty() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamStringAsync(ClientDiagnostics, pipeline, scenario: "empty", "", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterStringNull() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamStringAsync(ClientDiagnostics, pipeline, scenario: "null", null, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseStringValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseStringAsync(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseStringNull() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseStringAsync(ClientDiagnostics, pipeline, scenario: "null", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseStringEmpty() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseStringAsync(ClientDiagnostics, pipeline, scenario: "empty", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong date format")]
|
||||
public Task HeaderParameterDateValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDateAsync(ClientDiagnostics, pipeline, scenario: "valid", new DateTime(2010, 1, 1), host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong date format")]
|
||||
public Task HeaderParameterDateMin() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDateAsync(ClientDiagnostics, pipeline, scenario: "min", new DateTime(0001, 1, 1), host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDateValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDateAsync(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDateMin() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDateAsync(ClientDiagnostics, pipeline, scenario: "min", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong date format")]
|
||||
public Task HeaderParameterDateTimeValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDatetimeAsync(ClientDiagnostics, pipeline, scenario: "valid", new DateTime(2010, 1, 1, 12, 34, 56), host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong date format")]
|
||||
public Task HeaderParameterDateTimeMin() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDatetimeAsync(ClientDiagnostics, pipeline, scenario: "valid", new DateTime(2010, 1, 1, 12, 34, 56), host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDateTimeValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDatetimeAsync(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDateTimeMin() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDatetimeAsync(ClientDiagnostics, pipeline, scenario: "min", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong date format")]
|
||||
public Task HeaderParameterDateTimeRfc1123Valid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDatetimeRfc1123Async(ClientDiagnostics, pipeline, scenario: "valid", new DateTime(2010, 1, 1, 12, 34, 56), host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong date format")]
|
||||
public Task HeaderParameterDateTimeRfc1123Min() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDatetimeRfc1123Async(ClientDiagnostics, pipeline, scenario: "min", new DateTime(2010, 1, 1, 12, 34, 56), host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDateTimeRfc1123Valid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDatetimeRfc1123Async(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDateTimeRfc1123Min() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDatetimeRfc1123Async(ClientDiagnostics, pipeline, scenario: "min", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("wrong duration format")]
|
||||
public Task HeaderParameterDurationValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamDurationAsync(ClientDiagnostics, pipeline, scenario: "valid", TimeSpan.FromSeconds(1), host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseDurationValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseDurationAsync(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("Byte[] not supported")]
|
||||
public Task HeaderParameterBytesValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamByteAsync(ClientDiagnostics, pipeline, scenario: "valid", new byte[1], host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseBytesValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseByteAsync(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterEnumValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamEnumAsync(ClientDiagnostics, pipeline, scenario: "valid", GreyscaleColors.GREY, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderParameterEnumNull() => TestStatus(async (host, pipeline) => await HeaderOperations.ParamEnumAsync(ClientDiagnostics, pipeline, scenario: "null", null, host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseEnumValid() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseEnumAsync(ClientDiagnostics, pipeline, scenario: "valid", host: host));
|
||||
|
||||
[Test]
|
||||
public Task HeaderResponseEnumNull() => TestStatus(async (host, pipeline) => await HeaderOperations.ResponseEnumAsync(ClientDiagnostics, pipeline, scenario: "null", host: host));
|
||||
|
||||
[Test]
|
||||
[Ignore("Azure.Core doesn't provide the feature yet")]
|
||||
public Task CustomHeaderInRequest() => TestStatus(async (host, pipeline) => await HeaderOperations.CustomRequestIdAsync(ClientDiagnostics, pipeline, host: host));
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче