diff --git a/ClientProxyBase/ClientProxyBase.cs b/ClientProxyBase/ClientProxyBase.cs index b36d62e..23de2c3 100644 --- a/ClientProxyBase/ClientProxyBase.cs +++ b/ClientProxyBase/ClientProxyBase.cs @@ -55,9 +55,9 @@ protected virtual async Task HandleResponse(HttpResponseMessage response case HttpStatusCode.NotFound: throw new KeyNotFoundException(content); case HttpStatusCode.InternalServerError: - throw new Exception("An internal error has occurred"); + throw new ClientHttpException("An internal error has occurred"); default: - throw new Exception($"An internal error has occurred ({responseMessage.StatusCode})"); + throw new ClientHttpException($"An internal error has occurred ({responseMessage.StatusCode})"); } } @@ -103,4 +103,11 @@ protected virtual ResponseData HandleResponseContent(String content) } #endregion +} + +public class ClientHttpException : Exception { + public ClientHttpException(string? message, + Exception? innerException = null) : base(message, innerException) { + + } } \ No newline at end of file diff --git a/Shared.EventStore.Tests/ApplicationBuilderExtensionsTests.cs b/Shared.EventStore.Tests/ApplicationBuilderExtensionsTests.cs index 4807c02..c6eda84 100644 --- a/Shared.EventStore.Tests/ApplicationBuilderExtensionsTests.cs +++ b/Shared.EventStore.Tests/ApplicationBuilderExtensionsTests.cs @@ -57,7 +57,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_WorkerListReturn eventHandlerResolvers.Add("Main", deh.Object); eventHandlerResolvers.Add("Domain", deh.Object); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(3); } @@ -90,7 +90,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_NoneEnabled_Work eventHandlerResolvers.Add("Ordered", deh.Object); eventHandlerResolvers.Add("Main", deh.Object); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(0); } @@ -107,7 +107,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_NoWorkers_Worker String eventStoreConnectionString = "esdb://192.168.0.133:2113?tls=true&tlsVerifyCert=false"; Dictionary eventHandlerResolvers = new(); Action traceHandler = null; - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(0); } @@ -133,7 +133,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_OrderedOnlyWorke Dictionary eventHandlerResolvers = new(); eventHandlerResolvers.Add("Ordered", deh.Object); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(1); result.Single().InflightMessages.ShouldBe(1); @@ -158,7 +158,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_OrderedOnlyWorke String eventStoreConnectionString = "esdb://192.168.0.133:2113?tls=true&tlsVerifyCert=false"; Dictionary eventHandlerResolvers = new(); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(0); } @@ -186,7 +186,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_MainOnlyWorkers_ Dictionary eventHandlerResolvers = new(); eventHandlerResolvers.Add("Main", deh.Object); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(1); result.Single().InflightMessages.ShouldBe(500); @@ -213,7 +213,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_MainOnlyWorkers_ String eventStoreConnectionString = "esdb://192.168.0.133:2113?tls=true&tlsVerifyCert=false"; Dictionary eventHandlerResolvers = new(); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(0); } @@ -241,7 +241,7 @@ public void ApplicationBuilderExtensions_ConfigureSubscriptions_MainOnlyWorkers_ Dictionary eventHandlerResolvers = new(); eventHandlerResolvers.Add("Main", deh.Object); Action traceHandler = (et, type, msg) => TestOutputHelper.WriteLine(msg); - var result = IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository.Object, config, + var result = IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository.Object, config, eventStoreConnectionString, eventHandlerResolvers, traceHandler); result.Count.ShouldBe(2); } diff --git a/Shared.EventStore/Aggregate/AggregateVersion.cs b/Shared.EventStore/Aggregate/AggregateVersion.cs index 1dffac2..043c548 100644 --- a/Shared.EventStore/Aggregate/AggregateVersion.cs +++ b/Shared.EventStore/Aggregate/AggregateVersion.cs @@ -9,10 +9,6 @@ public struct AggregateVersion : IComparable { #region Constructors - /// - /// Initializes a new instance of the class. - /// - /// The Value. [Newtonsoft.Json.JsonConstructor] private AggregateVersion(Int64 value) : this() { @@ -23,10 +19,6 @@ private AggregateVersion(Int64 value) : this() #region Properties - /// - /// Gets the Value. - /// - /// The value. [JsonProperty(Order = 1)] public Int64 Value { get; private set; } @@ -34,52 +26,27 @@ private AggregateVersion(Int64 value) : this() #region Methods - /// - /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. - /// - /// An object to compare with this instance. - /// A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes in the sort order. Zero This instance occurs in the same position in the sort order as . Greater than zero This instance follows in the sort order. - /// public Int32 CompareTo(Object obj) { AggregateVersion otherVersion = (AggregateVersion)obj; return this.Value.CompareTo(otherVersion.Value); } - /// - /// The create. - /// - /// The value. - /// The . public static AggregateVersion CreateFrom(Int64 value) { return new AggregateVersion(value); } - /// - /// Creates the a new aggregate ID. - /// - /// AggregateVersion. public static AggregateVersion CreateNew() { return new AggregateVersion(0); } - /// - /// Equalses the specified other. - /// - /// The other. - /// Boolean. public Boolean Equals(AggregateVersion other) { return this.Value.Equals(other.Value); } - /// - /// Determines whether the specified , is equal to this instance. - /// - /// The to compare with this instance. - /// true if the specified is equal to this instance; otherwise, false. public override Boolean Equals(Object obj) { if (object.ReferenceEquals(null, obj)) @@ -90,77 +57,54 @@ public override Boolean Equals(Object obj) return obj is AggregateVersion && this.Equals((AggregateVersion)obj); } - /// - /// Returns a hash code for this instance. - /// - /// A hash code for this instance, suitable for use in hashing algorithms and aggregateEvent structures like a hash table. public override Int32 GetHashCode() { return this.Value.GetHashCode(); } - /// - /// Parses the specified identifier. - /// - /// The value as string. - /// AggregateVersion. public static AggregateVersion Parse(String valueAsString) { return AggregateVersion.CreateFrom(Int64.Parse(valueAsString)); } - /// - /// Returns the underlying value of this instance as a string. - /// - /// A containing a fully qualified type name. public override String ToString() { return this.Value.ToString(CultureInfo.InvariantCulture); } - /// - /// Implements the operator ==. - /// - /// The left hand. - /// The right hand. - /// The result of the operator. public static Boolean operator ==(AggregateVersion leftHand, AggregateVersion rightHand) { return leftHand.Value == rightHand.Value; } - /// - /// Performs an implicit conversion from to . - /// - /// The aggregate version. - /// The result of the conversion. public static implicit operator Int64(AggregateVersion aggregateVersion) { return aggregateVersion.Value; } - /// - /// Performs an implicit conversion from to . - /// - /// The value. - /// The result of the conversion. public static implicit operator AggregateVersion(Int64 value) { return AggregateVersion.CreateFrom(value); } - /// - /// Implements the operator !=. - /// - /// The left hand. - /// The right hand. - /// The result of the operator. public static Boolean operator !=(AggregateVersion leftHand, AggregateVersion rightHand) { return leftHand.Value != rightHand.Value; } + public static bool operator <(AggregateVersion left, AggregateVersion right) => + left.Value < right.Value; + + public static bool operator >(AggregateVersion left, AggregateVersion right) => + left.Value > right.Value; + + public static bool operator <=(AggregateVersion left, AggregateVersion right) => + left.Value <= right.Value; + + public static bool operator >=(AggregateVersion left, AggregateVersion right) => + left.Value >= right.Value; + #endregion } \ No newline at end of file diff --git a/Shared.EventStore/Aggregate/DomainEventFactory.cs b/Shared.EventStore/Aggregate/DomainEventFactory.cs index fbf36c2..e4086b5 100644 --- a/Shared.EventStore/Aggregate/DomainEventFactory.cs +++ b/Shared.EventStore/Aggregate/DomainEventFactory.cs @@ -43,8 +43,8 @@ public DomainEvent CreateDomainEvent(Guid aggregateId, ResolvedEvent @event) try{ eventType = TypeMap.GetType(@event.Event.EventType); } - catch(Exception) - { + catch (Exception) { + // ignored } if (eventType == null) diff --git a/Shared.EventStore/Aggregate/TypeMapConvertor.cs b/Shared.EventStore/Aggregate/TypeMapConvertor.cs index 839ae4f..d0780e1 100644 --- a/Shared.EventStore/Aggregate/TypeMapConvertor.cs +++ b/Shared.EventStore/Aggregate/TypeMapConvertor.cs @@ -45,7 +45,7 @@ public static IDomainEvent Convertor(Guid aggregateId, ResolvedEvent @event) } if (eventType == null) - throw new Exception($"Could not find EventType {@event.Event.EventType} in mapping list."); + throw new NullReferenceException($"Could not find EventType {@event.Event.EventType} in mapping list."); if (eventType.IsSubclassOf(typeof(DomainEvent))) { diff --git a/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs b/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs index d3927a9..8e67cdc 100644 --- a/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs +++ b/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Builder; using SubscriptionWorker; -public static class IApplicationBuilderExtenstions +public static class IApplicationBuilderExtensions { #region Methods @@ -27,13 +27,13 @@ public static async Task ConfigureSubscriptionService(this IApplicationBuilder a using (CancellationTokenSource cts = new()) { if (workerConfig == null) - throw new Exception("No Worker configuration supplied"); + throw new ArgumentNullException("No Worker configuration supplied"); if (subscriptionRepositoryResolver == null) - throw new Exception("No Subscription Repository Resolver supplied"); + throw new ArgumentNullException("No Subscription Repository Resolver supplied"); if (!workerConfig.InternalSubscriptionService) return; if (workerConfig.SubscriptionWorkers == null || !workerConfig.SubscriptionWorkers.Any()) - throw new Exception("No SubscriptionWorkers supplied"); + throw new ArgumentNullException("No SubscriptionWorkers supplied"); ISubscriptionRepository subscriptionRepository = subscriptionRepositoryResolver(eventStoreConnectionString, workerConfig.InternalSubscriptionServiceCacheDuration); @@ -46,7 +46,7 @@ public static async Task ConfigureSubscriptionService(this IApplicationBuilder a await subscriptionRepository.PreWarm(cts.Token); List workers = - IApplicationBuilderExtenstions.ConfigureSubscriptions(subscriptionRepository, workerConfig, + IApplicationBuilderExtensions.ConfigureSubscriptions(subscriptionRepository, workerConfig, eventStoreConnectionString, eventHandlerResolvers, traceHandler); foreach (SubscriptionWorker subscriptionWorker in workers) { diff --git a/Shared.IntegrationTesting/BaseDockerHelper.cs b/Shared.IntegrationTesting/BaseDockerHelper.cs index 4eb9ca3..66e2d68 100644 --- a/Shared.IntegrationTesting/BaseDockerHelper.cs +++ b/Shared.IntegrationTesting/BaseDockerHelper.cs @@ -258,14 +258,14 @@ public static IHostService GetDockerHost(){ return details.Value; } - public (String imageName, Boolean useLatest) GetImageDetails(ContainerType key){ + public SimpleResults.Result<(String imageName, Boolean useLatest)> GetImageDetails(ContainerType key){ KeyValuePair details = this.ImageDetails.SingleOrDefault(c => c.Key == key); if (details.Equals(default(KeyValuePair))){ // No details found so throw an error - throw new Exception($"No image details found for Container Type [{key}]"); + return Result.Failure($"No image details found for Container Type [{key}]"); } - return details.Value; + return Result.Success(details.Value); } protected DockerEnginePlatform DockerPlatform; @@ -302,7 +302,7 @@ public virtual ContainerBuilder SetupCallbackHandlerContainer(){ ContainerBuilder callbackHandlerContainer = new Builder().UseContainer().WithName(this.CallbackHandlerContainerName) .WithEnvironment(environmentVariables.ToArray()) - .UseImageDetails(this.GetImageDetails(ContainerType.CallbackHandler)) + .UseImageDetails(this.GetImageDetails(ContainerType.CallbackHandler).Data) .ExposePort(DockerPorts.CallbackHandlerDockerPort) .MountHostFolder(this.DockerPlatform,this.HostTraceFolder) .SetDockerCredentials(this.DockerCredentials); @@ -339,7 +339,7 @@ public virtual ContainerBuilder SetupEventStoreContainer(){ _ => "/etc/eventstore/certs" }; - ContainerBuilder eventStoreContainerBuilder = new Builder().UseContainer().UseImageDetails(this.GetImageDetails(ContainerType.EventStore)) + ContainerBuilder eventStoreContainerBuilder = new Builder().UseContainer().UseImageDetails(this.GetImageDetails(ContainerType.EventStore).Data) .ExposePort(DockerPorts.EventStoreHttpDockerPort).ExposePort(DockerPorts.EventStoreTcpDockerPort) .WithName(this.EventStoreContainerName); @@ -418,7 +418,7 @@ public virtual ContainerBuilder SetupFileProcessorContainer(){ ContainerBuilder fileProcessorContainer = new Builder().UseContainer().WithName(this.FileProcessorContainerName) .WithEnvironment(environmentVariables.ToArray()) - .UseImageDetails(this.GetImageDetails(ContainerType.FileProcessor)) + .UseImageDetails(this.GetImageDetails(ContainerType.FileProcessor).Data) .ExposePort(DockerPorts.FileProcessorDockerPort).MountHostFolder(this.DockerPlatform, this.HostTraceFolder) .SetDockerCredentials(this.DockerCredentials); @@ -455,7 +455,7 @@ public virtual ContainerBuilder SetupMessagingServiceContainer(){ ContainerBuilder messagingServiceContainer = new Builder().UseContainer().WithName(this.MessagingServiceContainerName) .WithEnvironment(environmentVariables.ToArray()) - .UseImageDetails(this.GetImageDetails(ContainerType.MessagingService)) + .UseImageDetails(this.GetImageDetails(ContainerType.MessagingService).Data) .ExposePort(DockerPorts.MessagingServiceDockerPort) .MountHostFolder(this.DockerPlatform, this.HostTraceFolder).SetDockerCredentials(this.DockerCredentials); @@ -489,7 +489,7 @@ public virtual ContainerBuilder SetupSecurityServiceContainer(){ ContainerBuilder securityServiceContainer = new Builder().UseContainer().WithName(this.SecurityServiceContainerName) .WithEnvironment(environmentVariables.ToArray()) - .UseImageDetails(this.GetImageDetails(ContainerType.SecurityService)) + .UseImageDetails(this.GetImageDetails(ContainerType.SecurityService).Data) .MountHostFolder(this.DockerPlatform, this.HostTraceFolder) .SetDockerCredentials(this.DockerCredentials); @@ -504,7 +504,7 @@ public virtual ContainerBuilder ConfigureSqlContainer() { this.Trace("About to start SQL Server Container"); ContainerBuilder containerService = new Builder().UseContainer().WithName(this.SqlServerContainerName) - .UseImageDetails(this.GetImageDetails(ContainerType.SqlServer)) + .UseImageDetails(this.GetImageDetails(ContainerType.SqlServer).Data) .WithEnvironment("ACCEPT_EULA=Y", $"SA_PASSWORD={this.SqlCredentials.Value.password}") .ExposePort(1433) .KeepContainer().KeepRunning().ReuseIfExists() @@ -515,7 +515,7 @@ public virtual ContainerBuilder ConfigureSqlContainer() public virtual async Task SetupSqlServerContainer(INetworkService networkService){ if (this.SqlCredentials == default) - throw new Exception("Sql Credentials have not been set"); + throw new ArgumentNullException("Sql Credentials have not been set"); IContainerService databaseServerContainer = await this.StartContainer2(this.ConfigureSqlContainer, new List{ @@ -540,7 +540,7 @@ public virtual ContainerBuilder SetupTestHostContainer(){ environmentVariables.AddRange(additionalEnvironmentVariables); } - (String imageName, Boolean useLatest) imageDetails = this.GetImageDetails(ContainerType.TestHost); + (String imageName, Boolean useLatest) imageDetails = this.GetImageDetails(ContainerType.TestHost).Data; ContainerBuilder testHostContainer = new Builder().UseContainer().WithName(this.TestHostContainerName).WithEnvironment(environmentVariables.ToArray()) .UseImageDetails(imageDetails).ExposePort(DockerPorts.TestHostPort) .MountHostFolder(this.DockerPlatform, this.HostTraceFolder) @@ -596,7 +596,7 @@ public virtual ContainerBuilder SetupTransactionProcessorAclContainer(){ ContainerBuilder transactionProcessorACLContainer = new Builder().UseContainer().WithName(this.TransactionProcessorAclContainerName) .WithEnvironment(environmentVariables.ToArray()) - .UseImageDetails(this.GetImageDetails(ContainerType.TransactionProcessorAcl)) + .UseImageDetails(this.GetImageDetails(ContainerType.TransactionProcessorAcl).Data) .ExposePort(DockerPorts.TransactionProcessorAclDockerPort) .MountHostFolder(this.DockerPlatform, this.HostTraceFolder) .SetDockerCredentials(this.DockerCredentials); @@ -624,7 +624,7 @@ public virtual ContainerBuilder SetupTransactionProcessorContainer(){ ContainerBuilder transactionProcessorContainer = new Builder().UseContainer().WithName(this.TransactionProcessorContainerName) .WithEnvironment(environmentVariables.ToArray()) - .UseImageDetails(this.GetImageDetails(ContainerType.TransactionProcessor)) + .UseImageDetails(this.GetImageDetails(ContainerType.TransactionProcessor).Data) .ExposePort(DockerPorts.TransactionProcessorDockerPort) .MountHostFolder(this.DockerPlatform, this.HostTraceFolder) .SetDockerCredentials(this.DockerCredentials); @@ -799,7 +799,7 @@ await Retry.For(async () => { } else { this.Trace($"health check failed for {containerType}"); - throw new Exception($"Health check failed for {containerType} [{healthCheckResult.Message}]"); + throw new InvalidOperationException($"Health check failed for {containerType} [{healthCheckResult.Message}]"); } }, TimeSpan.FromMinutes(3), TimeSpan.FromSeconds(20)); } diff --git a/Shared.Tests/ClientProxyBaseTests.cs b/Shared.Tests/ClientProxyBaseTests.cs index 0ec1374..696c31d 100644 --- a/Shared.Tests/ClientProxyBaseTests.cs +++ b/Shared.Tests/ClientProxyBaseTests.cs @@ -69,10 +69,10 @@ public async Task ClientProxyBase_HandleResponseX_1xx_ErrorStatus(HttpStatusCode } [Theory] - [InlineData(HttpStatusCode.Continue, typeof(Exception))] - [InlineData(HttpStatusCode.SwitchingProtocols, typeof(Exception))] - [InlineData(HttpStatusCode.Processing, typeof(Exception))] - [InlineData(HttpStatusCode.EarlyHints, typeof(Exception))] + [InlineData(HttpStatusCode.Continue, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.SwitchingProtocols, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Processing, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.EarlyHints, typeof(ClientHttpException))] public async Task ClientProxyBase_HandleResponse_1xx_ErrorStatus(HttpStatusCode statusCode, Type expectedException) { await TestMethod_HandleResponse(statusCode, expectedException); @@ -99,20 +99,20 @@ public async Task ClientProxyBase_HandleResponseX_3xx_ErrorStatus(HttpStatusCode } [Theory] - [InlineData(HttpStatusCode.MultipleChoices, typeof(Exception))] - [InlineData(HttpStatusCode.Ambiguous, typeof(Exception))] - [InlineData(HttpStatusCode.MovedPermanently, typeof(Exception))] - [InlineData(HttpStatusCode.Moved, typeof(Exception))] - [InlineData(HttpStatusCode.Found, typeof(Exception))] - [InlineData(HttpStatusCode.Redirect, typeof(Exception))] - [InlineData(HttpStatusCode.SeeOther, typeof(Exception))] - [InlineData(HttpStatusCode.RedirectMethod, typeof(Exception))] - [InlineData(HttpStatusCode.NotModified, typeof(Exception))] - [InlineData(HttpStatusCode.UseProxy, typeof(Exception))] - [InlineData(HttpStatusCode.Unused, typeof(Exception))] - [InlineData(HttpStatusCode.TemporaryRedirect, typeof(Exception))] - [InlineData(HttpStatusCode.RedirectKeepVerb, typeof(Exception))] - [InlineData(HttpStatusCode.PermanentRedirect, typeof(Exception))] + [InlineData(HttpStatusCode.MultipleChoices, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Ambiguous, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.MovedPermanently, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Moved, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Found, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Redirect, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.SeeOther, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RedirectMethod, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.NotModified, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.UseProxy, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Unused, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.TemporaryRedirect, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RedirectKeepVerb, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.PermanentRedirect, typeof(ClientHttpException))] public async Task ClientProxyBase_HandleResponse_3xx_ErrorStatus(HttpStatusCode statusCode, Type expectedException) { await TestMethod_HandleResponse(statusCode, expectedException); @@ -154,31 +154,31 @@ public async Task ClientProxyBase_HandleResponseX_4xx_ErrorStatus(HttpStatusCode [Theory] [InlineData(HttpStatusCode.BadRequest, typeof(InvalidOperationException))] [InlineData(HttpStatusCode.Unauthorized, typeof(UnauthorizedAccessException))] - [InlineData(HttpStatusCode.PaymentRequired, typeof(Exception))] + [InlineData(HttpStatusCode.PaymentRequired, typeof(ClientHttpException))] [InlineData(HttpStatusCode.Forbidden, typeof(UnauthorizedAccessException))] [InlineData(HttpStatusCode.NotFound, typeof(KeyNotFoundException))] - [InlineData(HttpStatusCode.MethodNotAllowed, typeof(Exception))] - [InlineData(HttpStatusCode.NotAcceptable, typeof(Exception))] - [InlineData(HttpStatusCode.ProxyAuthenticationRequired, typeof(Exception))] - [InlineData(HttpStatusCode.RequestTimeout, typeof(Exception))] - [InlineData(HttpStatusCode.Conflict, typeof(Exception))] - [InlineData(HttpStatusCode.Gone, typeof(Exception))] - [InlineData(HttpStatusCode.LengthRequired, typeof(Exception))] - [InlineData(HttpStatusCode.PreconditionFailed, typeof(Exception))] - [InlineData(HttpStatusCode.RequestEntityTooLarge, typeof(Exception))] - [InlineData(HttpStatusCode.RequestUriTooLong, typeof(Exception))] - [InlineData(HttpStatusCode.UnsupportedMediaType, typeof(Exception))] - [InlineData(HttpStatusCode.RequestedRangeNotSatisfiable, typeof(Exception))] - [InlineData(HttpStatusCode.ExpectationFailed, typeof(Exception))] - [InlineData(HttpStatusCode.MisdirectedRequest, typeof(Exception))] - [InlineData(HttpStatusCode.UnprocessableEntity, typeof(Exception))] - [InlineData(HttpStatusCode.Locked, typeof(Exception))] - [InlineData(HttpStatusCode.FailedDependency, typeof(Exception))] - [InlineData(HttpStatusCode.UpgradeRequired, typeof(Exception))] - [InlineData(HttpStatusCode.PreconditionRequired, typeof(Exception))] - [InlineData(HttpStatusCode.TooManyRequests, typeof(Exception))] - [InlineData(HttpStatusCode.RequestHeaderFieldsTooLarge, typeof(Exception))] - [InlineData(HttpStatusCode.UnavailableForLegalReasons, typeof(Exception))] + [InlineData(HttpStatusCode.MethodNotAllowed, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.NotAcceptable, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.ProxyAuthenticationRequired, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RequestTimeout, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Conflict, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Gone, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.LengthRequired, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.PreconditionFailed, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RequestEntityTooLarge, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RequestUriTooLong, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.UnsupportedMediaType, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RequestedRangeNotSatisfiable, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.ExpectationFailed, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.MisdirectedRequest, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.UnprocessableEntity, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.Locked, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.FailedDependency, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.UpgradeRequired, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.PreconditionRequired, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.TooManyRequests, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.RequestHeaderFieldsTooLarge, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.UnavailableForLegalReasons, typeof(ClientHttpException))] public async Task ClientProxyBase_HandleResponse_4xx_ErrorStatus(HttpStatusCode statusCode, Type expectedException) { await TestMethod_HandleResponse(statusCode, expectedException); @@ -202,17 +202,17 @@ public async Task ClientProxyBase_HandleResponseX_5xx_ErrorStatus(HttpStatusCode } [Theory] - [InlineData(HttpStatusCode.InternalServerError, typeof(Exception))] - [InlineData(HttpStatusCode.NotImplemented, typeof(Exception))] - [InlineData(HttpStatusCode.BadGateway, typeof(Exception))] - [InlineData(HttpStatusCode.ServiceUnavailable, typeof(Exception))] - [InlineData(HttpStatusCode.GatewayTimeout, typeof(Exception))] - [InlineData(HttpStatusCode.HttpVersionNotSupported, typeof(Exception))] - [InlineData(HttpStatusCode.VariantAlsoNegotiates, typeof(Exception))] - [InlineData(HttpStatusCode.InsufficientStorage, typeof(Exception))] - [InlineData(HttpStatusCode.LoopDetected, typeof(Exception))] - [InlineData(HttpStatusCode.NotExtended, typeof(Exception))] - [InlineData(HttpStatusCode.NetworkAuthenticationRequired, typeof(Exception))] + [InlineData(HttpStatusCode.InternalServerError, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.NotImplemented, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.BadGateway, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.ServiceUnavailable, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.GatewayTimeout, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.HttpVersionNotSupported, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.VariantAlsoNegotiates, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.InsufficientStorage, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.LoopDetected, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.NotExtended, typeof(ClientHttpException))] + [InlineData(HttpStatusCode.NetworkAuthenticationRequired, typeof(ClientHttpException))] public async Task ClientProxyBase_HandleResponse_5xx_ErrorStatus(HttpStatusCode statusCode, Type expectedException) { await TestMethod_HandleResponse(statusCode, expectedException);