Generate body-array/dictionary/collection (#365)
This commit is contained in:
Родитель
577f6beef0
Коммит
ce0d63484f
|
@ -46,15 +46,15 @@ $testNames = if ($name) { $name } else
|
|||
#'azure-resource',
|
||||
#'azure-resource-x',
|
||||
#'azure-special-properties',
|
||||
#'body-array',
|
||||
'body-array',
|
||||
'body-boolean',
|
||||
#'body-boolean.quirks',
|
||||
#'body-byte',
|
||||
'body-byte',
|
||||
'body-complex',
|
||||
'body-date',
|
||||
'body-datetime',
|
||||
'body-datetime-rfc1123',
|
||||
#'body-dictionary',
|
||||
'body-dictionary',
|
||||
'body-duration',
|
||||
#'body-file',
|
||||
#'body-formdata',
|
||||
|
|
|
@ -221,7 +221,7 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
}
|
||||
}
|
||||
|
||||
private CodeWriter.CodeWriterScope WriteValueNullCheck(CodeWriter writer, ConstantOrParameter value)
|
||||
private CodeWriter.CodeWriterScope? WriteValueNullCheck(CodeWriter writer, ConstantOrParameter value)
|
||||
{
|
||||
if (value.IsConstant) return default;
|
||||
|
||||
|
@ -298,17 +298,18 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
|
||||
using (responseBody != null ? writer.Scope() : default)
|
||||
{
|
||||
string? valueVariable = null;
|
||||
|
||||
if (responseBody != null)
|
||||
{
|
||||
writer.Line($"using var document = await {writer.Type(typeof(JsonDocument))}.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);");
|
||||
writer.Append($"var value = ");
|
||||
writer.ToDeserializeCall(
|
||||
responseBody.Value,
|
||||
responseBody.Format,
|
||||
_typeFactory,
|
||||
w => w.Append($"document.RootElement")
|
||||
w => w.Append($"document.RootElement"),
|
||||
out valueVariable
|
||||
);
|
||||
writer.Line($";");
|
||||
}
|
||||
|
||||
if (headersModelType != null)
|
||||
|
@ -322,10 +323,10 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
writer.Append($"return {typeof(ResponseWithHeaders)}.FromValue(headers, response);");
|
||||
break;
|
||||
case { } when headersModelType != null:
|
||||
writer.Append($"return {typeof(ResponseWithHeaders)}.FromValue(value, headers, response);");
|
||||
writer.Append($"return {typeof(ResponseWithHeaders)}.FromValue({valueVariable}, headers, response);");
|
||||
break;
|
||||
case { }:
|
||||
writer.Append($"return {typeof(Response)}.FromValue(value, response);");
|
||||
writer.Append($"return {typeof(Response)}.FromValue({valueVariable}, response);");
|
||||
break;
|
||||
case null:
|
||||
writer.Append($"return response;");
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AutoRest.CSharp.V3.Utilities;
|
||||
|
@ -17,12 +18,21 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
private readonly List<CSharpNamespace> _usingNamespaces = new List<CSharpNamespace>();
|
||||
private readonly StringBuilder _builder = new StringBuilder();
|
||||
private readonly string _definitionAccessDefault = "public";
|
||||
private readonly Stack<CodeWriterScope> _scopes;
|
||||
private CSharpNamespace? _currentNamespace;
|
||||
|
||||
public CodeWriter()
|
||||
{
|
||||
_scopes = new Stack<CodeWriterScope>();
|
||||
_scopes.Push(new CodeWriterScope(this, ""));
|
||||
}
|
||||
|
||||
public CodeWriterScope Scope(string start = "{", string end = "}")
|
||||
{
|
||||
LineRaw(start);
|
||||
return new CodeWriterScope(this, end);
|
||||
CodeWriterScope codeWriterScope = new CodeWriterScope(this, end);
|
||||
_scopes.Push(codeWriterScope);
|
||||
return codeWriterScope;
|
||||
}
|
||||
|
||||
public CodeWriterScope Namespace(CSharpNamespace @namespace)
|
||||
|
@ -40,6 +50,7 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
}
|
||||
|
||||
const string literalFormatString = ":L";
|
||||
const string declarationFormatString = ":D"; // :D :)
|
||||
foreach ((string Text, bool IsLiteral) part in StringExtensions.GetPathParts(formattableString.Format))
|
||||
{
|
||||
string text = part.Text;
|
||||
|
@ -57,6 +68,7 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
|
||||
var argument = formattableString.GetArgument(index);
|
||||
var isLiteral = text.EndsWith(literalFormatString);
|
||||
var isDeclaration = text.EndsWith(declarationFormatString);
|
||||
switch (argument)
|
||||
{
|
||||
case CodeWriterDelegate d:
|
||||
|
@ -72,16 +84,23 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
if (isLiteral)
|
||||
{
|
||||
Literal(argument);
|
||||
continue;
|
||||
}
|
||||
|
||||
string? s = argument?.ToString();
|
||||
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException(index.ToString());
|
||||
}
|
||||
|
||||
|
||||
if (isDeclaration)
|
||||
{
|
||||
Declaration(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
string? s = argument?.ToString();
|
||||
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException(index.ToString());
|
||||
}
|
||||
|
||||
AppendRaw(s);
|
||||
}
|
||||
break;
|
||||
|
@ -172,6 +191,37 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
_usingNamespaces.Add(@namespace);
|
||||
}
|
||||
|
||||
public string GetTemporaryVariable(string s)
|
||||
{
|
||||
if (IsAvailable(s))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
var name = s + i;
|
||||
if (IsAvailable(name))
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
throw new InvalidOperationException("Can't find suitable variable name.");
|
||||
}
|
||||
|
||||
private bool IsAvailable(string s)
|
||||
{
|
||||
foreach (CodeWriterScope codeWriterScope in _scopes)
|
||||
{
|
||||
if (codeWriterScope.Identifiers.Contains(s))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public string Type(CSharpType type)
|
||||
{
|
||||
string? mappedName = GetKeywordMapping(type.FrameworkType);
|
||||
|
@ -276,6 +326,13 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
return this;
|
||||
}
|
||||
|
||||
public CodeWriter Declaration(string name)
|
||||
{
|
||||
_scopes.Peek().Identifiers.Add(name);
|
||||
|
||||
return AppendRaw(name);
|
||||
}
|
||||
|
||||
public CodeWriter Append(CodeWriterDelegate writerDelegate)
|
||||
{
|
||||
writerDelegate(this);
|
||||
|
@ -320,18 +377,30 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
|
||||
public override string? ToString() => _builder.ToString();
|
||||
|
||||
internal readonly struct CodeWriterScope : IDisposable
|
||||
internal class CodeWriterScope : IDisposable
|
||||
{
|
||||
private readonly CodeWriter _writer;
|
||||
private readonly string _end;
|
||||
|
||||
public List<string> Identifiers { get; } = new List<string>();
|
||||
|
||||
public CodeWriterScope(CodeWriter writer, string end)
|
||||
{
|
||||
_writer = writer;
|
||||
_end = end;
|
||||
}
|
||||
|
||||
public void Dispose() => _writer?.LineRaw(_end);
|
||||
public void Dispose()
|
||||
{
|
||||
_writer.PopScope(this);
|
||||
_writer?.LineRaw(_end);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopScope(CodeWriterScope expected)
|
||||
{
|
||||
var actual = _scopes.Pop();
|
||||
Debug.Assert(actual == expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,17 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
{
|
||||
case CollectionTypeReference array:
|
||||
writer.Line($"{writerName}.WriteStartArray();");
|
||||
writer.Line($"foreach (var item in {name})");
|
||||
string collectionItemVariable = writer.GetTemporaryVariable("item");
|
||||
writer.Line($"foreach (var {collectionItemVariable:D} in {name})");
|
||||
using (writer.Scope())
|
||||
{
|
||||
writer.ToSerializeCall(array.ItemType, format, typeFactory, w => w.Append($"item"));
|
||||
writer.ToSerializeCall(
|
||||
array.ItemType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.AppendRaw(collectionItemVariable),
|
||||
serializedName: null,
|
||||
writerName);
|
||||
}
|
||||
|
||||
writer.Line($"{writerName}.WriteEndArray();");
|
||||
|
@ -34,15 +41,17 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
|
||||
case DictionaryTypeReference dictionary:
|
||||
writer.Line($"{writerName}.WriteStartObject();");
|
||||
writer.Line($"foreach (var item in {name})");
|
||||
string itemVariable = writer.GetTemporaryVariable("item");
|
||||
writer.Line($"foreach (var {itemVariable:D} in {name})");
|
||||
using (writer.Scope())
|
||||
{
|
||||
writer.ToSerializeCall(
|
||||
dictionary.ValueType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.Append($"item.Value"),
|
||||
w => w.Append($"item.Key"));
|
||||
w => w.Append($"{itemVariable}.Value"),
|
||||
w => w.Append($"{itemVariable}.Key"),
|
||||
writerName);
|
||||
}
|
||||
|
||||
writer.Line($"{writerName}.WriteEndObject();");
|
||||
|
@ -116,33 +125,90 @@ namespace AutoRest.CSharp.V3.CodeGen
|
|||
}
|
||||
}
|
||||
|
||||
public static void ToDeserializeCall(this CodeWriter writer, ClientTypeReference type, SerializationFormat format, TypeFactory typeFactory, CodeWriterDelegate element, out string destination)
|
||||
{
|
||||
destination = writer.GetTemporaryVariable("value");
|
||||
|
||||
if (CanDeserializeAsExpression(type))
|
||||
{
|
||||
writer.Append($"var {destination:D} =")
|
||||
.ToDeserializeCall(type, format, typeFactory, element);
|
||||
writer.LineRaw(";");
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = destination;
|
||||
|
||||
writer
|
||||
.Line($"{typeFactory.CreateType(type)} {destination:D} = new {typeFactory.CreateConcreteType(type)}();")
|
||||
.ToDeserializeCall(type, format, typeFactory, w=>w.AppendRaw(s), element);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool CanDeserializeAsExpression(ClientTypeReference type)
|
||||
{
|
||||
return !(type is CollectionTypeReference || type is DictionaryTypeReference);
|
||||
}
|
||||
|
||||
public static void ToDeserializeCall(this CodeWriter writer, ClientTypeReference type, SerializationFormat format, TypeFactory typeFactory, CodeWriterDelegate destination, CodeWriterDelegate element)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CollectionTypeReference array:
|
||||
using (writer.ForEach("var item in property.Value.EnumerateArray()"))
|
||||
string collectionItemVariable = writer.GetTemporaryVariable("item");
|
||||
writer.Line($"foreach (var {collectionItemVariable:D} in {element}.EnumerateArray())");
|
||||
using (writer.Scope())
|
||||
{
|
||||
writer.Append($"{destination}.Add(");
|
||||
writer.ToDeserializeCall(
|
||||
array.ItemType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.Append($"item"));
|
||||
writer.Line($");");
|
||||
if (CanDeserializeAsExpression(array.ItemType))
|
||||
{
|
||||
writer.Append($"{destination}.Add(");
|
||||
writer.ToDeserializeCall(
|
||||
array.ItemType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.AppendRaw(collectionItemVariable));
|
||||
writer.Line($");");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.ToDeserializeCall(
|
||||
array.ItemType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.AppendRaw(collectionItemVariable),
|
||||
out var temp);
|
||||
|
||||
writer.Append($"{destination}.Add({temp});");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
case DictionaryTypeReference dictionary:
|
||||
using (writer.ForEach("var item in property.Value.EnumerateObject()"))
|
||||
string itemVariable = writer.GetTemporaryVariable("item");
|
||||
writer.Line($"foreach (var {itemVariable:D} in {element}.EnumerateObject())");
|
||||
using (writer.Scope())
|
||||
{
|
||||
writer.Append($"{destination}.Add(item.Name, ");
|
||||
writer.ToDeserializeCall(
|
||||
dictionary.ValueType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.Append($"item.Value"));
|
||||
writer.Line($");");
|
||||
if (CanDeserializeAsExpression(dictionary.ValueType))
|
||||
{
|
||||
writer.Append($"{destination}.Add({itemVariable}.Name, ");
|
||||
writer.ToDeserializeCall(
|
||||
dictionary.ValueType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.Append($"{itemVariable}.Value"));
|
||||
writer.Line($");");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.ToDeserializeCall(
|
||||
dictionary.ValueType,
|
||||
format,
|
||||
typeFactory,
|
||||
w => w.Append($"{itemVariable}.Value"),
|
||||
out var temp);
|
||||
|
||||
writer.Append($"{destination}.Add({itemVariable}.Name, {temp});");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"Standalone": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "--standalone --input-codemodel=$(SolutionDir)\\test\\TestServerProjects\\body-complex\\CodeModel.yaml --plugin=cs-modeler --output-path=$(SolutionDir)/test/TestServerProjects/body-complex/ --namespace=body_complex"
|
||||
"commandLineArgs": "--standalone --input-codemodel=$(SolutionDir)\\test\\TestServerProjects\\body-dictionary\\CodeModel.yaml --plugin=cs-modeler --output-path=$(SolutionDir)/test/TestServerProjects/body-dictionary/ --namespace=body_dictionary"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Azure.Core
|
|||
}
|
||||
}
|
||||
|
||||
public static DateTimeOffset GetDateTimeOffset(in this JsonElement element, string format) => format switch
|
||||
public static DateTimeOffset GetDateTimeOffset(in this JsonElement element, string format = "S") => format switch
|
||||
{
|
||||
"D" => element.GetDateTimeOffset(),
|
||||
"S" => element.GetDateTimeOffset(),
|
||||
|
@ -56,7 +56,7 @@ namespace Azure.Core
|
|||
_ => throw new ArgumentException("Format is not supported", nameof(format))
|
||||
};
|
||||
|
||||
public static TimeSpan GetTimeSpan(in this JsonElement element, string format) => format switch
|
||||
public static TimeSpan GetTimeSpan(in this JsonElement element, string format = "P") => format switch
|
||||
{
|
||||
"P" => XmlConvert.ToTimeSpan(element.GetString()),
|
||||
_ => throw new ArgumentException("Format is not supported", nameof(format))
|
||||
|
|
|
@ -9,10 +9,10 @@ namespace Azure.Core
|
|||
{
|
||||
internal static class Utf8JsonWriterExtensions
|
||||
{
|
||||
public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) =>
|
||||
public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format = "S") =>
|
||||
writer.WriteStringValue(TypeFormatters.ToString(value, format));
|
||||
|
||||
public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) =>
|
||||
public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format = "P") =>
|
||||
writer.WriteStringValue(TypeFormatters.ToString(value, format));
|
||||
|
||||
public static void WriteObjectValue(this Utf8JsonWriter writer, IUtf8JsonSerializable value)
|
||||
|
|
|
@ -0,0 +1,536 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using AutoRest.TestServer.Tests.Infrastructure;
|
||||
using body_array;
|
||||
using body_array.Models.V100;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class BodyArray : TestServerTestBase
|
||||
{
|
||||
public BodyArray(TestServerVersion version) : base(version, "array") { }
|
||||
|
||||
[Test]
|
||||
public Task GetArrayArrayEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetArrayEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.IsEmpty(result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayArrayItemEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetArrayItemEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { new object[] { "1", "2", "3" }, new object[] { }, new object[] { "7", "8", "9" } }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/366")]
|
||||
public Task GetArrayArrayItemNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetArrayItemNullAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
Assert.IsNull(result.Value.Single());
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/289")]
|
||||
public Task GetArrayArrayNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetArrayNullAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
Assert.IsNull(result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayArrayValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetArrayValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { new object[] { "1", "2", "3" }, new object[] { "4", "5", "6" }, new object[] { "7", "8", "9" } }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/367")]
|
||||
public Task GetArrayBase64Url() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetBase64UrlAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { new object[] { "1", "2", "3" }, new object[] { "4", "5", "6" }, new object[] { "7", "8", "9" } }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayBooleanValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetBooleanTfftAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { true, false, false, true }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayBooleanWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetBooleanInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayBooleanWithString() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetBooleanInvalidStringAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayByteValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetByteValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { new[] { 255, 255, 255, 250 }, new[] { 1, 2, 3 }, new[] { 37, 41, 67 } }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayByteWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetByteInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayComplexEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetComplexEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.IsEmpty(result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayComplexItemEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetComplexItemEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
var values = result.Value.ToArray();
|
||||
|
||||
Assert.AreEqual(3, values.Length);
|
||||
Assert.AreEqual(1, values[0].Integer);
|
||||
Assert.AreEqual("2", values[0].String);
|
||||
|
||||
Assert.AreEqual(null, values[1].Integer);
|
||||
Assert.AreEqual(null, values[1].String);
|
||||
|
||||
|
||||
Assert.AreEqual(5, values[2].Integer);
|
||||
Assert.AreEqual("6", values[2].String);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/366")]
|
||||
public Task GetArrayComplexItemNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetComplexItemNullAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
var values = result.Value.ToArray();
|
||||
|
||||
Assert.AreEqual(3, values.Length);
|
||||
Assert.AreEqual(1, values[0].Integer);
|
||||
Assert.AreEqual("2", values[0].String);
|
||||
|
||||
Assert.AreEqual(null, values[1]);
|
||||
|
||||
|
||||
Assert.AreEqual(5, values[2].Integer);
|
||||
Assert.AreEqual("6", values[2].String);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/289")]
|
||||
public Task GetArrayComplexNull() => Test(async (host, pipeline) => { await Task.FromException(new Exception()); });
|
||||
|
||||
[Test]
|
||||
public Task GetArrayComplexValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetComplexValidAsync(ClientDiagnostics, pipeline, host);
|
||||
var values = result.Value.ToArray();
|
||||
|
||||
Assert.AreEqual(3, values.Length);
|
||||
Assert.AreEqual(1, values[0].Integer);
|
||||
Assert.AreEqual("2", values[0].String);
|
||||
|
||||
Assert.AreEqual(3, values[1].Integer);
|
||||
Assert.AreEqual("4", values[1].String);
|
||||
|
||||
|
||||
Assert.AreEqual(5, values[2].Integer);
|
||||
Assert.AreEqual("6", values[2].String);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/368")]
|
||||
public Task GetArrayDateTimeRfc1123Valid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDateTimeRfc1123ValidAsync(ClientDiagnostics, pipeline, host);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/368")]
|
||||
public Task GetArrayDateTimeValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDateTimeValidAsync(ClientDiagnostics, pipeline, host);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDateTimeWithInvalidChars() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetDateTimeInvalidCharsAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDateTimeWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetDateTimeInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDateValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDateValidAsync(ClientDiagnostics, pipeline, host);
|
||||
CollectionAssert.AreEqual(new[]
|
||||
{
|
||||
DateTimeOffset.Parse("2000-12-01"),
|
||||
DateTimeOffset.Parse("1980-01-02"),
|
||||
DateTimeOffset.Parse("1492-10-12"),
|
||||
}, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDateWithInvalidChars() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetDateInvalidCharsAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDateWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetDateInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDictionaryEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDictionaryEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.IsEmpty(result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDictionaryItemEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDictionaryItemEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
var values = result.Value.ToArray();
|
||||
|
||||
Assert.AreEqual(3, values.Length);
|
||||
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "1", "one" }, { "2", "two" }, { "3", "three" } }, values[0]);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>(), values[1]);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "7", "seven" }, { "8", "eight" }, { "9", "nine" } }, values[2]);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/366")]
|
||||
public Task GetArrayDictionaryItemNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDictionaryItemEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
var values = result.Value.ToArray();
|
||||
|
||||
Assert.AreEqual(3, values.Length);
|
||||
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "1", "one" }, { "2", "two" }, { "3", "three" } }, values[0]);
|
||||
CollectionAssert.AreEqual(null, values[1]);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "7", "seven" }, { "8", "eight" }, { "9", "nine" } }, values[2]);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/289")]
|
||||
public Task GetArrayDictionaryNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDictionaryNullAsync(ClientDiagnostics, pipeline, host);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDictionaryValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDictionaryValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
var values = result.Value.ToArray();
|
||||
|
||||
Assert.AreEqual(3, values.Length);
|
||||
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "1", "one" }, { "2", "two" }, { "3", "three" } }, values[0]);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "4", "four" }, { "5", "five" }, { "6", "six" }, }, values[1]);
|
||||
CollectionAssert.AreEqual(new Dictionary<string, string>() { { "7", "seven" }, { "8", "eight" }, { "9", "nine" } }, values[2]);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDoubleValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDoubleValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new double[] { 0, -0.01, -1.2e20 }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDoubleWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetDoubleInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDoubleWithString() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetDoubleInvalidStringAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayDurationValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetDurationValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[]
|
||||
{
|
||||
XmlConvert.ToTimeSpan("P123DT22H14M12.011S"),
|
||||
XmlConvert.ToTimeSpan("P5DT1H0M0S"),
|
||||
}, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetEmptyAsync(ClientDiagnostics, pipeline, host);
|
||||
CollectionAssert.IsEmpty(result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "no match")]
|
||||
public Task GetArrayEnumValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetEnumValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { FooEnum.Foo1, FooEnum.Foo2, FooEnum.Foo3 }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayFloatValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetFloatValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { 0, -0.01f, -1.2e20f }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayFloatWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetFloatInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayFloatWithString() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetFloatInvalidStringAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayIntegerValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetIntegerValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { 1, -1, 3, 300 }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayIntegerWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetIntInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayIntegerWithString() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetIntInvalidStringAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayInvalid() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetInvalidAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayLongValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetLongValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { 1, -1, 3, 300L }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayLongWithNull() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetLongInvalidNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayLongWithString() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetLongInvalidStringAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/289")]
|
||||
public Task GetArrayNull() => Test(async (host, pipeline) => { await Task.FromException(new Exception()); });
|
||||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "no match")]
|
||||
public Task GetArrayStringEnumValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetStringEnumValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { Enum0.Foo1, Enum0.Foo2, Enum0.Foo3 }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayStringValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetStringValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { "foo1", "foo2", "foo3" }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayStringWithNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetStringWithNullAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { "foo", null, "foo2" }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetArrayStringWithNumber() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetStringWithInvalidAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
//TODO: https://github.com/Azure/autorest.csharp/issues/369
|
||||
public Task GetArrayUuidValid() => Test(async (host, pipeline) =>
|
||||
{
|
||||
var result = await ArrayOperations.GetUuidValidAsync(ClientDiagnostics, pipeline, host);
|
||||
|
||||
CollectionAssert.AreEqual(new[] { "6dcc7237-45fe-45c4-8a6b-3a8a3f625652", "d1399005-30f7-40d6-8da6-dd7c89ad34db", "f42f6aa1-a5bc-4ddf-907e-5f915de43205" }, result.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/369")]
|
||||
public Task GetArrayUuidWithInvalidChars() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ArrayOperations.GetUuidInvalidCharsAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutArrayArrayValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutArrayValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { new[] { "1", "2", "3" }, new[] { "4", "5", "6" }, new[] { "7", "8", "9" } }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayBooleanValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutBooleanTfftAsync(ClientDiagnostics, pipeline,
|
||||
new[] { true, false, false, true }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayByteValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutByteValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { new byte[] { 255, 255, 255, 250 }, new byte[] { 1, 2, 3 }, new byte[] { 37, 41, 67 } }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayComplexValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutComplexValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { new Product() { Integer = 1, String = "2" }, new Product() { Integer = 3, String = "4" }, new Product() { Integer = 5, String = "6" }}, host));
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/368")]
|
||||
public Task PutArrayDateTimeRfc1123Valid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutDateTimeRfc1123ValidAsync(ClientDiagnostics, pipeline,
|
||||
new DateTimeOffset[] { }, host));
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/368")]
|
||||
public Task PutArrayDateTimeValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutDateValidAsync(ClientDiagnostics, pipeline,
|
||||
new DateTimeOffset[] { }, host));
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/368")]
|
||||
public Task PutArrayDateValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutDateValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] {
|
||||
DateTimeOffset.Parse("2000-12-01"),
|
||||
DateTimeOffset.Parse("1980-01-02"),
|
||||
DateTimeOffset.Parse("1492-10-12")
|
||||
}, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayDictionaryValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutDictionaryValidAsync(ClientDiagnostics, pipeline,
|
||||
new[]
|
||||
{
|
||||
new Dictionary<string, string>() { { "1", "one" }, { "2", "two" }, { "3", "three" } },
|
||||
new Dictionary<string, string>() { { "4", "four" }, { "5", "five" }, { "6", "six" } },
|
||||
new Dictionary<string, string>() { { "7", "seven" }, { "8", "eight" }, { "9", "nine" } }
|
||||
}, host));
|
||||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "no match")]
|
||||
public Task PutArrayDoubleValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutDoubleValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { 0, -0.01, -1.2e20 }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayDurationValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutDurationValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] {
|
||||
XmlConvert.ToTimeSpan("P123DT22H14M12.011S"),
|
||||
XmlConvert.ToTimeSpan("P5DT1H0M0S")
|
||||
}, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayEmpty() => TestStatus(async (host, pipeline) => await ArrayOperations.PutEmptyAsync(ClientDiagnostics, pipeline,
|
||||
new string[] { }, host));
|
||||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "no match")]
|
||||
public Task PutArrayEnumValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutEnumValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { FooEnum.Foo1, FooEnum.Foo2, FooEnum.Foo3 }, host));
|
||||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "no match")]
|
||||
public Task PutArrayFloatValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutFloatValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { 0, -0.01f, -1.2e20f }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayIntegerValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutIntegerValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { 1, -1, 3, 300 }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayLongValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutLongValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { 1, -1, 3, 300L }, host));
|
||||
|
||||
[Test]
|
||||
[IgnoreOnTestServer(TestServerVersion.V2, "no match")]
|
||||
public Task PutArrayStringEnumValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutStringEnumValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { Enum0.Foo1, Enum0.Foo2, Enum0.Foo3 }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayStringValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutStringValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { "foo1", "foo2", "foo3" }, host));
|
||||
|
||||
[Test]
|
||||
public Task PutArrayUuidValid() => TestStatus(async (host, pipeline) => await ArrayOperations.PutUuidValidAsync(ClientDiagnostics, pipeline,
|
||||
new[] { "6dcc7237-45fe-45c4-8a6b-3a8a3f625652", "d1399005-30f7-40d6-8da6-dd7c89ad34db", "f42f6aa1-a5bc-4ddf-907e-5f915de43205" }, host));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using AutoRest.TestServer.Tests.Infrastructure;
|
||||
using body_byte;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AutoRest.TestServer.Tests
|
||||
{
|
||||
public class BodyByte : TestServerTestBase
|
||||
{
|
||||
public BodyByte(TestServerVersion version) : base(version, "byte") { }
|
||||
|
||||
[Test]
|
||||
public Task GetByteEmpty() => Test(async (host, pipeline) =>
|
||||
{
|
||||
CollectionAssert.IsEmpty((await ByteOperations.GetEmptyAsync(ClientDiagnostics, pipeline, host)).Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetByteInvalid() => Test((host, pipeline) =>
|
||||
{
|
||||
Assert.ThrowsAsync(Is.InstanceOf<Exception>(), async () => await ByteOperations.GetInvalidAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task GetByteNonAscii() => Test(async (host, pipeline) => {
|
||||
CollectionAssert.AreEqual(new byte[]{ 255, 254, 253, 252, 251, 250, 249, 248, 247, 246 },
|
||||
(await ByteOperations.GetNonAsciiAsync(ClientDiagnostics, pipeline, host)).Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
[Ignore("https://github.com/Azure/autorest.csharp/issues/289")]
|
||||
public Task GetByteNull() => Test(async (host, pipeline) =>
|
||||
{
|
||||
Assert.Null(await ByteOperations.GetNullAsync(ClientDiagnostics, pipeline, host));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task PutByteNonAscii() => TestStatus(async (host, pipeline) => await ByteOperations.PutNonAsciiAsync(ClientDiagnostics, pipeline, new byte[] { 255, 254, 253, 252, 251, 250, 249, 248, 247, 246 }, host));
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
public readonly partial struct Enum0 : IEquatable<Enum0>
|
||||
{
|
||||
private readonly string? _value;
|
||||
|
||||
public Enum0(string value)
|
||||
{
|
||||
_value = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
private const string Foo1Value = "foo1";
|
||||
private const string Foo2Value = "foo2";
|
||||
private const string Foo3Value = "foo3";
|
||||
|
||||
public static Enum0 Foo1 { get; } = new Enum0(Foo1Value);
|
||||
public static Enum0 Foo2 { get; } = new Enum0(Foo2Value);
|
||||
public static Enum0 Foo3 { get; } = new Enum0(Foo3Value);
|
||||
public static bool operator ==(Enum0 left, Enum0 right) => left.Equals(right);
|
||||
public static bool operator !=(Enum0 left, Enum0 right) => !left.Equals(right);
|
||||
public static implicit operator Enum0(string value) => new Enum0(value);
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object? obj) => obj is Enum0 other && Equals(other);
|
||||
public bool Equals(Enum0 other) => string.Equals(_value, other._value, StringComparison.Ordinal);
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
|
||||
public override string? ToString() => _value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
using Azure.Core;
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
public partial class Error : IUtf8JsonSerializable
|
||||
{
|
||||
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
if (Status != null)
|
||||
{
|
||||
writer.WritePropertyName("status");
|
||||
writer.WriteNumberValue(Status.Value);
|
||||
}
|
||||
if (Message != null)
|
||||
{
|
||||
writer.WritePropertyName("message");
|
||||
writer.WriteStringValue(Message);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Error DeserializeError(JsonElement element)
|
||||
{
|
||||
var result = new Error();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("status"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Status = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("message"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Message = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
public partial class Error
|
||||
{
|
||||
public int? Status { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
internal static class FooEnumExtensions
|
||||
{
|
||||
public static string ToSerialString(this FooEnum value) => value switch
|
||||
{
|
||||
FooEnum.Foo1 => "foo1",
|
||||
FooEnum.Foo2 => "foo2",
|
||||
FooEnum.Foo3 => "foo3",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown FooEnum value.")
|
||||
};
|
||||
|
||||
public static FooEnum ToFooEnum(this string value) => value switch
|
||||
{
|
||||
"foo1" => FooEnum.Foo1,
|
||||
"foo2" => FooEnum.Foo2,
|
||||
"foo3" => FooEnum.Foo3,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown FooEnum value.")
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
public enum FooEnum
|
||||
{
|
||||
Foo1,
|
||||
Foo2,
|
||||
Foo3
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
using Azure.Core;
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
public partial class Product : IUtf8JsonSerializable
|
||||
{
|
||||
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
if (Integer != null)
|
||||
{
|
||||
writer.WritePropertyName("integer");
|
||||
writer.WriteNumberValue(Integer.Value);
|
||||
}
|
||||
if (String != null)
|
||||
{
|
||||
writer.WritePropertyName("string");
|
||||
writer.WriteStringValue(String);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Product DeserializeProduct(JsonElement element)
|
||||
{
|
||||
var result = new Product();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("integer"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Integer = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("string"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.String = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace body_array.Models.V100
|
||||
{
|
||||
public partial class Product
|
||||
{
|
||||
public int? Integer { get; set; }
|
||||
public string? String { get; set; }
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>annotations</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Core" Version="1.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
using Azure.Core;
|
||||
|
||||
namespace body_byte.Models.V100
|
||||
{
|
||||
public partial class Error : IUtf8JsonSerializable
|
||||
{
|
||||
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
if (Status != null)
|
||||
{
|
||||
writer.WritePropertyName("status");
|
||||
writer.WriteNumberValue(Status.Value);
|
||||
}
|
||||
if (Message != null)
|
||||
{
|
||||
writer.WritePropertyName("message");
|
||||
writer.WriteStringValue(Message);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Error DeserializeError(JsonElement element)
|
||||
{
|
||||
var result = new Error();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("status"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Status = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("message"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Message = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace body_byte.Models.V100
|
||||
{
|
||||
public partial class Error
|
||||
{
|
||||
public int? Status { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
|
||||
namespace body_byte
|
||||
{
|
||||
internal static class ByteOperations
|
||||
{
|
||||
public static async ValueTask<Response<Byte[]>> GetNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (host == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(host));
|
||||
}
|
||||
|
||||
using var scope = clientDiagnostics.CreateScope("body_byte.GetNull");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(new Uri($"{host}"));
|
||||
request.Uri.AppendPath("/byte/null", false);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
switch (response.Status)
|
||||
{
|
||||
case 200:
|
||||
{
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
var value = document.RootElement.GetBytesFromBase64();
|
||||
return Response.FromValue(value, response);
|
||||
}
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public static async ValueTask<Response<Byte[]>> GetEmptyAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (host == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(host));
|
||||
}
|
||||
|
||||
using var scope = clientDiagnostics.CreateScope("body_byte.GetEmpty");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(new Uri($"{host}"));
|
||||
request.Uri.AppendPath("/byte/empty", false);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
switch (response.Status)
|
||||
{
|
||||
case 200:
|
||||
{
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
var value = document.RootElement.GetBytesFromBase64();
|
||||
return Response.FromValue(value, response);
|
||||
}
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public static async ValueTask<Response<Byte[]>> GetNonAsciiAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (host == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(host));
|
||||
}
|
||||
|
||||
using var scope = clientDiagnostics.CreateScope("body_byte.GetNonAscii");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(new Uri($"{host}"));
|
||||
request.Uri.AppendPath("/byte/nonAscii", false);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
switch (response.Status)
|
||||
{
|
||||
case 200:
|
||||
{
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
var value = document.RootElement.GetBytesFromBase64();
|
||||
return Response.FromValue(value, response);
|
||||
}
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public static async ValueTask<Response> PutNonAsciiAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Byte[] byteBody, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (host == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(host));
|
||||
}
|
||||
if (byteBody == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(byteBody));
|
||||
}
|
||||
|
||||
using var scope = clientDiagnostics.CreateScope("body_byte.PutNonAscii");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(new Uri($"{host}"));
|
||||
request.Uri.AppendPath("/byte/nonAscii", false);
|
||||
request.Headers.Add("Content-Type", "application/json");
|
||||
using var content = new Utf8JsonRequestContent();
|
||||
content.JsonWriter.WriteBase64StringValue(byteBody);
|
||||
request.Content = content;
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
switch (response.Status)
|
||||
{
|
||||
case 200:
|
||||
return response;
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public static async ValueTask<Response<Byte[]>> GetInvalidAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (host == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(host));
|
||||
}
|
||||
|
||||
using var scope = clientDiagnostics.CreateScope("body_byte.GetInvalid");
|
||||
scope.Start();
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(new Uri($"{host}"));
|
||||
request.Uri.AppendPath("/byte/invalid", false);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
switch (response.Status)
|
||||
{
|
||||
case 200:
|
||||
{
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
var value = document.RootElement.GetBytesFromBase64();
|
||||
return Response.FromValue(value, response);
|
||||
}
|
||||
default:
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>annotations</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Core" Version="1.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
using Azure.Core;
|
||||
|
||||
namespace body_dictionary.Models.V100
|
||||
{
|
||||
public partial class Error : IUtf8JsonSerializable
|
||||
{
|
||||
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
if (Status != null)
|
||||
{
|
||||
writer.WritePropertyName("status");
|
||||
writer.WriteNumberValue(Status.Value);
|
||||
}
|
||||
if (Message != null)
|
||||
{
|
||||
writer.WritePropertyName("message");
|
||||
writer.WriteStringValue(Message);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Error DeserializeError(JsonElement element)
|
||||
{
|
||||
var result = new Error();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("status"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Status = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("message"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Message = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace body_dictionary.Models.V100
|
||||
{
|
||||
public partial class Error
|
||||
{
|
||||
public int? Status { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
using Azure.Core;
|
||||
|
||||
namespace body_dictionary.Models.V100
|
||||
{
|
||||
public partial class Widget : IUtf8JsonSerializable
|
||||
{
|
||||
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
if (Integer != null)
|
||||
{
|
||||
writer.WritePropertyName("integer");
|
||||
writer.WriteNumberValue(Integer.Value);
|
||||
}
|
||||
if (String != null)
|
||||
{
|
||||
writer.WritePropertyName("string");
|
||||
writer.WriteStringValue(String);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Widget DeserializeWidget(JsonElement element)
|
||||
{
|
||||
var result = new Widget();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("integer"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Integer = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("string"))
|
||||
{
|
||||
if (property.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.String = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace body_dictionary.Models.V100
|
||||
{
|
||||
public partial class Widget
|
||||
{
|
||||
public int? Integer { get; set; }
|
||||
public string? String { get; set; }
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>annotations</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Core" Version="1.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Двоичные данные
test/scripts/TestList.txt
Двоичные данные
test/scripts/TestList.txt
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче