From 8a35466e9d91202e42edbf4ee40227ad30c3ef75 Mon Sep 17 00:00:00 2001 From: John Hart Date: Mon, 6 Jun 2016 14:34:58 -0700 Subject: [PATCH] Fixed broken test MappingExtensionTests.TestInputMappings (#1123) * Fixed the TestInputMappings tests and added missing extensions test DLLs to xunitTestDLLs in gulpfile.js * Updated Expected files for tests that were added after commit 6d06584 so they now have the exception xmldoc comments * Updated TestInputMapping to not have hard coded path --- .../AutoRestDurationTestService.cs | 18 +++ .../DurationOperations.cs | 24 ++++ .../IDurationOperations.cs | 21 +++ .../Models/ErrorException.cs | 3 + .../AutoRestDurationTestService.cs | 18 +++ .../DurationOperations.cs | 24 ++++ .../IDurationOperations.cs | 21 +++ .../Models/ErrorException.cs | 3 + .../Expected/Additional.Properties/Get.cs | 9 ++ .../Expected/Additional.Properties/IGet.cs | 6 + .../Expected/Additional.Properties/IPost.cs | 6 + .../Expected/Additional.Properties/IPut.cs | 6 + .../Additional.Properties/PetStoreonHeroku.cs | 6 + .../Expected/Additional.Properties/Post.cs | 9 ++ .../Expected/Additional.Properties/Put.cs | 9 ++ .../Expected/PetstoreV2AllSync/Models/Pet.cs | 5 +- .../PetstoreV2AllSync/SwaggerPetstoreV2.cs | 135 ++++++++++++++++++ .../Expected/PetstoreV2NoSync/Models/Pet.cs | 5 +- .../PetstoreV2NoSync/SwaggerPetstoreV2.cs | 135 ++++++++++++++++++ .../Extensions.Tests/MappingTests.cs | 9 +- gulpfile.js | 4 +- 21 files changed, 468 insertions(+), 8 deletions(-) diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs index 72bd4cd57bc9..343555c4d514 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs @@ -106,6 +106,9 @@ protected AutoRestDurationTestService(HttpClientHandler rootHandler, params Dele /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// protected AutoRestDurationTestService(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -127,6 +130,9 @@ protected AutoRestDurationTestService(Uri baseUri, params DelegatingHandler[] ha /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// protected AutoRestDurationTestService(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) @@ -145,6 +151,9 @@ protected AutoRestDurationTestService(Uri baseUri, HttpClientHandler rootHandler /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) @@ -170,6 +179,9 @@ public AutoRestDurationTestService(ServiceClientCredentials credentials, params /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) @@ -195,6 +207,9 @@ public AutoRestDurationTestService(ServiceClientCredentials credentials, HttpCli /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -228,6 +243,9 @@ public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credent /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs index 81ec07668d7d..80a7a22c836f 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs @@ -35,6 +35,9 @@ internal partial class DurationOperations : IServiceOperations /// Reference to the service client. /// + /// + /// Thrown when a required parameter is null + /// internal DurationOperations(AutoRestDurationTestService client) { if (client == null) @@ -58,6 +61,12 @@ internal DurationOperations(AutoRestDurationTestService client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -206,6 +215,9 @@ internal DurationOperations(AutoRestDurationTestService client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// /// /// A response object containing the response body and response headers. /// @@ -338,6 +350,12 @@ public async Task PutPositiveDurationWithHttpMessagesAsy /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -484,6 +502,12 @@ public async Task PutPositiveDurationWithHttpMessagesAsy /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IDurationOperations.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IDurationOperations.cs index 08caf84df02c..b44f43b7bb57 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IDurationOperations.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IDurationOperations.cs @@ -31,6 +31,12 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task> GetNullWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Put a positive duration value @@ -43,6 +49,9 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// Task PutPositiveDurationWithHttpMessagesAsync(TimeSpan durationBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a positive duration value @@ -53,6 +62,12 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task> GetPositiveDurationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get an invalid duration value @@ -63,6 +78,12 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task> GetInvalidWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/Models/ErrorException.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/Models/ErrorException.cs index 8b02d920b472..ed7672915ae1 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/Models/ErrorException.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/Models/ErrorException.cs @@ -81,6 +81,9 @@ protected ErrorException(SerializationInfo info, StreamingContext context) /// /// Serialization info. /// Streaming context. + /// + /// Thrown when a required parameter is null + /// [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs index 8adef14be4bb..bd9a8b84b571 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs @@ -106,6 +106,9 @@ protected AutoRestDurationTestService(HttpClientHandler rootHandler, params Dele /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// protected AutoRestDurationTestService(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -127,6 +130,9 @@ protected AutoRestDurationTestService(Uri baseUri, params DelegatingHandler[] ha /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// protected AutoRestDurationTestService(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) @@ -145,6 +151,9 @@ protected AutoRestDurationTestService(Uri baseUri, HttpClientHandler rootHandler /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) @@ -170,6 +179,9 @@ public AutoRestDurationTestService(ServiceClientCredentials credentials, params /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) @@ -195,6 +207,9 @@ public AutoRestDurationTestService(ServiceClientCredentials credentials, HttpCli /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -228,6 +243,9 @@ public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credent /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs index 44b091050b15..df4eccfb9e74 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs @@ -35,6 +35,9 @@ internal partial class DurationOperations : IServiceOperations /// Reference to the service client. /// + /// + /// Thrown when a required parameter is null + /// internal DurationOperations(AutoRestDurationTestService client) { if (client == null) @@ -58,6 +61,12 @@ internal DurationOperations(AutoRestDurationTestService client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -206,6 +215,9 @@ internal DurationOperations(AutoRestDurationTestService client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// /// /// A response object containing the response body and response headers. /// @@ -338,6 +350,12 @@ public async Task PutPositiveDurationWithHttpMessagesAsy /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -484,6 +502,12 @@ public async Task PutPositiveDurationWithHttpMessagesAsy /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IDurationOperations.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IDurationOperations.cs index 128a7a4cea18..972bf1012045 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IDurationOperations.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IDurationOperations.cs @@ -31,6 +31,12 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task> GetNullWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Put a positive duration value @@ -43,6 +49,9 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// Task PutPositiveDurationWithHttpMessagesAsync(TimeSpan durationBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a positive duration value @@ -53,6 +62,12 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task> GetPositiveDurationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get an invalid duration value @@ -63,6 +78,12 @@ public partial interface IDurationOperations /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task> GetInvalidWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/Models/ErrorException.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/Models/ErrorException.cs index 1902b5496c33..b06e7ea63c34 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/Models/ErrorException.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/Models/ErrorException.cs @@ -81,6 +81,9 @@ protected ErrorException(SerializationInfo info, StreamingContext context) /// /// Serialization info. /// Streaming context. + /// + /// Thrown when a required parameter is null + /// [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Get.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Get.cs index 9464df049aff..b267924ae271 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Get.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Get.cs @@ -34,6 +34,9 @@ public partial class Get : IServiceOperations, IGet /// /// Reference to the service client. /// + /// + /// Thrown when a required parameter is null + /// public Get(PetStoreonHeroku client) { if (client == null) @@ -57,6 +60,12 @@ public Get(PetStoreonHeroku client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IGet.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IGet.cs index 8441b6544b9c..f03984995469 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IGet.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IGet.cs @@ -30,6 +30,12 @@ public partial interface IGet /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// Task>> PetsWithHttpMessagesAsync(int? limit = 11, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPost.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPost.cs index 6b5423b4a4c2..7527bdbb26cb 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPost.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPost.cs @@ -30,6 +30,12 @@ public partial interface IPost /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// Task PetsWithHttpMessagesAsync(Pet pet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPut.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPut.cs index 79a1f17c9ec9..27a0184ae295 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPut.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/IPut.cs @@ -30,6 +30,12 @@ public partial interface IPut /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// Task PetsWithHttpMessagesAsync(Pet pet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/PetStoreonHeroku.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/PetStoreonHeroku.cs index ab5924a4b282..a9022e7d68bb 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/PetStoreonHeroku.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/PetStoreonHeroku.cs @@ -93,6 +93,9 @@ public PetStoreonHeroku(HttpClientHandler rootHandler, params DelegatingHandler[ /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public PetStoreonHeroku(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -114,6 +117,9 @@ public PetStoreonHeroku(Uri baseUri, params DelegatingHandler[] handlers) : this /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public PetStoreonHeroku(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Post.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Post.cs index 301d47eb8289..dced68c50c48 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Post.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Post.cs @@ -34,6 +34,9 @@ public partial class Post : IServiceOperations, IPost /// /// Reference to the service client. /// + /// + /// Thrown when a required parameter is null + /// public Post(PetStoreonHeroku client) { if (client == null) @@ -57,6 +60,12 @@ public Post(PetStoreonHeroku client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Put.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Put.cs index 9282fba3131a..551085676fbb 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Put.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/Additional.Properties/Put.cs @@ -34,6 +34,9 @@ public partial class Put : IServiceOperations, IPut /// /// Reference to the service client. /// + /// + /// Thrown when a required parameter is null + /// public Put(PetStoreonHeroku client) { if (client == null) @@ -57,6 +60,12 @@ public Put(PetStoreonHeroku client) /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/Models/Pet.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/Models/Pet.cs index 006deb06f472..b60f2e5bb1e1 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/Models/Pet.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/Models/Pet.cs @@ -86,8 +86,11 @@ public Pet(string name, IList photoUrls, long? id = default(long?), Cate public string Status { get; set; } /// - /// Validate the object. Throws ValidationException if validation fails. + /// Validate the object. /// + /// + /// Thrown if validation fails + /// public virtual void Validate() { if (Name == null) diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/SwaggerPetstoreV2.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/SwaggerPetstoreV2.cs index 2d744c04bc7f..389a226b6a39 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/SwaggerPetstoreV2.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2AllSync/SwaggerPetstoreV2.cs @@ -82,6 +82,9 @@ public SwaggerPetstoreV2(HttpClientHandler rootHandler, params DelegatingHandler /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public SwaggerPetstoreV2(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -103,6 +106,9 @@ public SwaggerPetstoreV2(Uri baseUri, params DelegatingHandler[] handlers) : thi /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public SwaggerPetstoreV2(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) @@ -161,6 +167,15 @@ private void Initialize() /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -286,6 +301,12 @@ public async Task> AddPetWithHttpMessagesAsync(Pet bo /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -394,6 +415,15 @@ public async Task UpdatePetWithHttpMessagesAsync(Pet body /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -520,6 +550,15 @@ public async Task>> FindPetsByStatusWithHttpMes /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -645,6 +684,12 @@ public async Task>> FindPetsByTagsWithHttpMessa /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -766,6 +811,12 @@ public async Task> GetPetByIdWithHttpMessagesAsync(lo /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -895,6 +946,9 @@ public async Task UpdatePetWithFormWithHttpMessagesAsync( /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// /// /// A response object containing the response body and response headers. /// @@ -996,6 +1050,12 @@ public async Task DeletePetWithHttpMessagesAsync(long pet /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -1106,6 +1166,15 @@ public async Task DeletePetWithHttpMessagesAsync(long pet /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1229,6 +1298,15 @@ public async Task> PlaceOrderWithHttpMessagesAsync( /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1358,6 +1436,12 @@ public async Task> GetOrderByIdWithHttpMessagesAsyn /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1464,6 +1548,12 @@ public async Task DeleteOrderWithHttpMessagesAsync(string /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1567,6 +1657,12 @@ public async Task CreateUserWithHttpMessagesAsync(User bo /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1670,6 +1766,12 @@ public async Task CreateUsersWithArrayInputWithHttpMessag /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1776,6 +1878,15 @@ public async Task CreateUsersWithListInputWithHttpMessage /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1919,6 +2030,9 @@ public async Task CreateUsersWithListInputWithHttpMessage /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// /// /// A response object containing the response body and response headers. /// @@ -2011,6 +2125,15 @@ public async Task LogoutUserWithHttpMessagesAsync(Diction /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -2131,6 +2254,12 @@ public async Task> GetUserByNameWithHttpMessagesAsyn /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -2241,6 +2370,12 @@ public async Task UpdateUserWithHttpMessagesAsync(string /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/Models/Pet.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/Models/Pet.cs index b49d6ed7eddc..104eef1ad898 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/Models/Pet.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/Models/Pet.cs @@ -86,8 +86,11 @@ public Pet(string name, IList photoUrls, long? id = default(long?), Cate public string Status { get; set; } /// - /// Validate the object. Throws ValidationException if validation fails. + /// Validate the object. /// + /// + /// Thrown if validation fails + /// public virtual void Validate() { if (Name == null) diff --git a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/SwaggerPetstoreV2.cs b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/SwaggerPetstoreV2.cs index 4a0b55bf23e4..6dc2cc719282 100644 --- a/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/SwaggerPetstoreV2.cs +++ b/AutoRest/Generators/CSharp/CSharp.Tests/Expected/PetstoreV2NoSync/SwaggerPetstoreV2.cs @@ -82,6 +82,9 @@ public SwaggerPetstoreV2(HttpClientHandler rootHandler, params DelegatingHandler /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public SwaggerPetstoreV2(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) @@ -103,6 +106,9 @@ public SwaggerPetstoreV2(Uri baseUri, params DelegatingHandler[] handlers) : thi /// /// Optional. The delegating handlers to add to the http client pipeline. /// + /// + /// Thrown when a required parameter is null + /// public SwaggerPetstoreV2(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) @@ -161,6 +167,15 @@ private void Initialize() /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -286,6 +301,12 @@ public async Task> AddPetWithHttpMessagesAsync(Pet bo /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -394,6 +415,15 @@ public async Task UpdatePetWithHttpMessagesAsync(Pet body /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -520,6 +550,15 @@ public async Task>> FindPetsByStatusWithHttpMes /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -645,6 +684,12 @@ public async Task>> FindPetsByTagsWithHttpMessa /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -766,6 +811,12 @@ public async Task> GetPetByIdWithHttpMessagesAsync(lo /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -895,6 +946,9 @@ public async Task UpdatePetWithFormWithHttpMessagesAsync( /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// /// /// A response object containing the response body and response headers. /// @@ -996,6 +1050,12 @@ public async Task DeletePetWithHttpMessagesAsync(long pet /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// /// /// A response object containing the response body and response headers. /// @@ -1106,6 +1166,15 @@ public async Task DeletePetWithHttpMessagesAsync(long pet /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1229,6 +1298,15 @@ public async Task> PlaceOrderWithHttpMessagesAsync( /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1358,6 +1436,12 @@ public async Task> GetOrderByIdWithHttpMessagesAsyn /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1464,6 +1548,12 @@ public async Task DeleteOrderWithHttpMessagesAsync(string /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1567,6 +1657,12 @@ public async Task CreateUserWithHttpMessagesAsync(User bo /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1670,6 +1766,12 @@ public async Task CreateUsersWithArrayInputWithHttpMessag /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1776,6 +1878,15 @@ public async Task CreateUsersWithListInputWithHttpMessage /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -1919,6 +2030,9 @@ public async Task CreateUsersWithListInputWithHttpMessage /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// /// /// A response object containing the response body and response headers. /// @@ -2011,6 +2125,15 @@ public async Task LogoutUserWithHttpMessagesAsync(Diction /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -2131,6 +2254,12 @@ public async Task> GetUserByNameWithHttpMessagesAsyn /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// @@ -2241,6 +2370,12 @@ public async Task UpdateUserWithHttpMessagesAsync(string /// /// The cancellation token. /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// diff --git a/AutoRest/Generators/Extensions/Extensions.Tests/MappingTests.cs b/AutoRest/Generators/Extensions/Extensions.Tests/MappingTests.cs index 3552847f2b1e..0781bd6190d8 100644 --- a/AutoRest/Generators/Extensions/Extensions.Tests/MappingTests.cs +++ b/AutoRest/Generators/Extensions/Extensions.Tests/MappingTests.cs @@ -11,7 +11,7 @@ namespace Microsoft.Rest.Generator.Tests { public class MappingExtensionsTests { - [Fact(Skip = "true")] + [Fact] public void TestInputMapping() { var settings = new Settings @@ -19,7 +19,7 @@ public void TestInputMapping() Namespace = "Test", Input = Path.Combine("Swagger", "swagger-payload-flatten.json"), PayloadFlatteningThreshold = 3, - OutputDirectory = "X:\\" + OutputDirectory = Path.GetTempPath() }; settings.FileSystem = new MemoryFileSystem(); settings.FileSystem.WriteFile("AutoRest.json", File.ReadAllText("AutoRest.json")); @@ -31,12 +31,11 @@ public void TestInputMapping() CSharpCodeGenerator generator = new CSharpCodeGenerator(settings); generator.NormalizeClientModel(clientModel); generator.Generate(clientModel).GetAwaiter().GetResult(); - string body = settings.FileSystem.ReadFileAsText("X:\\Payload.cs"); + string body = settings.FileSystem.ReadFileAsText(Path.Combine(settings.OutputDirectory, "Payload.cs")); Assert.True(body.ContainsMultiline(@" - MinProduct minProduct = default(MinProduct); + MinProduct minProduct = new MinProduct(); if (baseProductId != null || baseProductDescription != null || maxProductReference != null) { - minProduct = new MinProduct(); minProduct.BaseProductId = baseProductId; minProduct.BaseProductDescription = baseProductDescription; minProduct.MaxProductReference = maxProductReference; diff --git a/gulpfile.js b/gulpfile.js index 13dd7589b0b7..93e531382721 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -626,7 +626,9 @@ gulp.task('test:python:azure', shell.task('tox', {cwd: './AutoRest/Generators/Py var xunitTestsDlls = [ 'AutoRest/AutoRest.Core.Tests/bin/Net45-Debug/AutoRest.Core.Tests.dll', 'AutoRest/Modelers/Swagger.Tests/bin/Net45-Debug/AutoRest.Modeler.Swagger.Tests.dll', - 'AutoRest/Generators/Azure.Common/Azure.Common.Tests/bin/Net45-Debug/AutoRest.Generator.Azure.Common.Tests.dll' + 'AutoRest/Generators/Azure.Common/Azure.Common.Tests/bin/Net45-Debug/AutoRest.Generator.Azure.Common.Tests.dll', + 'AutoRest/Generators/Extensions/Extensions.Tests/bin/Net45-Debug/AutoRest.Generator.Extensions.Tests.dll', + 'AutoRest/Generators/Extensions/Azure.Extensions.Tests/bin/Net45-Debug/AutoRest.Generator.Azure.Extensions.Tests.dll' ]; var xunitNetCoreXproj = [