Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library upgrade to version V2.10.1 #177

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,44 +136,6 @@ private void ShouldReturnValidationProblemDetailOnBadRequest(
.BeEquivalentTo(expectedBadRequestObjectResult);
}

[Theory]
[MemberData(nameof(SerializationCases))]
private void ShouldReturnValidationProblemDetailOnUnathorized(
JsonSerializerOptions jsonSerializerOptions)
{
// given
Dictionary<string, List<string>> randomDictionary =
CreateRandomDictionary();

var inputException = new Exception();

var expectedProblemDetail = new ValidationProblemDetails
{
Status = StatusCodes.Status401Unauthorized,
Type = "https://tools.ietf.org/html/rfc7235#section-3.1",
Title = inputException.Message,
};

var expectedUnauthorizedObjectResult =
new UnauthorizedObjectResult(expectedProblemDetail);

SetupInputAndExpectedCriteria(
randomDictionary,
inputException,
expectedProblemDetail,
jsonSerializerOptions);

var restfulController = new RESTFulController(jsonSerializerOptions);

// when
UnauthorizedObjectResult unauthorizedObjectResult =
restfulController.Unauthorized(inputException);

// then
unauthorizedObjectResult.Should()
.BeEquivalentTo(expectedUnauthorizedObjectResult);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this deleted?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe got deleted by mistake. I've updated again. Will be see in the next revision once I push.


[Theory]
[MemberData(nameof(SerializationCases))]
private void ShouldReturnValidationProblemDetailOnPaymentRequired(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private void ShouldThrowValidationExceptionOnConvertIfModelIsInvalid()
{
// given
object nullObject = null;
var nullObjectException = new NullObjectException();
var nullObjectException = new NullObjectException(message:"Object is null.");

var expectedFormCoordinationValidationException =
new FormCoordinationValidationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public static TheoryData DependencyValidationExceptions()

return new TheoryData<Xeption>
{
new FormOrchestrationValidationException(innerException),
new FormOrchestrationDependencyValidationException(innerException),
new PropertyOrchestrationValidationException(innerException),
new PropertyOrchestrationDependencyValidationException(innerException)
new FormOrchestrationValidationException(randomMessage,innerException),
new FormOrchestrationDependencyValidationException(randomMessage,innerException),
new PropertyOrchestrationValidationException(randomMessage,innerException),
new PropertyOrchestrationDependencyValidationException(randomMessage,innerException)
};
}

Expand All @@ -98,10 +98,10 @@ public static TheoryData DependencyExceptions()

return new TheoryData<Xeption>
{
new FormOrchestrationDependencyException(innerException),
new FormOrchestrationServiceException(innerException),
new PropertyOrchestrationDependencyException(innerException),
new PropertyOrchestrationServiceException(innerException)
new FormOrchestrationDependencyException(randomMessage, innerException),
new FormOrchestrationServiceException(randomMessage,innerException),
new PropertyOrchestrationDependencyException(randomMessage,innerException),
new PropertyOrchestrationServiceException(randomMessage,innerException)
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ private void ShouldThrowFormServiceExceptionIfExceptionOccurs()
message: "Failed Form Service Exception occurred, please contact support for assistance.",
innerException: someException);


// Type exception: FormServiceException
// INNER Exception: FailedFormServiceException

// Current Inner Exception: SYSTEM.EXCEPTION
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comments except for // given, // when and // then

var expectedFormServiceException =
new FormServiceException(
message: "Form service error occurred, contact support.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void ShouldThrowDependencyExceptionOnBuildIfDependencyErrorOccurs(

var expectedFormOrchestrationDependencyException =
new FormOrchestrationDependencyException(
message: "Form orchestration dependency error occurred, fix errors and try again.",
message: "Form orchestration dependency validation error occurred, fix the errors and try again.",
innerException: dependancyException);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameters stay at the same level of indentation


this.attributeServiceMock.Setup(service =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ public static TheoryData DependencyValidationExceptions()

return new TheoryData<Xeption>
{
new AttributeValidationException(innerException),
new AttributeDependencyValidationException(innerException),
new ValueValidationException(innerException),
new ValueDependencyValidationException(innerException),
new FormValidationException(innerException),
new FormDependencyValidationException(innerException)
new AttributeValidationException(randomMessage,innerException),
new AttributeDependencyValidationException(randomMessage,innerException),
new ValueValidationException(randomMessage, innerException),
new ValueDependencyValidationException(randomMessage, innerException),
new FormValidationException(randomMessage,innerException),
new FormDependencyValidationException(randomMessage, innerException)
};
}

Expand All @@ -134,12 +134,12 @@ public static TheoryData DependencyExceptions()

return new TheoryData<Xeption>
{
new AttributeDependencyException(innerException),
new AttributeServiceException(innerException),
new ValueDependencyException(innerException),
new ValueServiceException(innerException),
new FormDependencyException(innerException),
new FormServiceException(innerException)
new AttributeDependencyException(randomMessage, innerException),
new AttributeServiceException(randomMessage,innerException),
new ValueDependencyException(randomMessage, innerException),
new ValueServiceException(randomMessage, innerException),
new FormDependencyException(randomMessage,innerException),
new FormServiceException(randomMessage, innerException)
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public static TheoryData DependencyValidationExceptions()

return new TheoryData<Xeption>
{
new TypeValidationException(innerException),
new TypeDependencyValidationException(innerException),
new PropertyValidationException(innerException),
new PropertyDependencyValidationException(innerException),
new TypeValidationException(randomMessage, innerException),
new TypeDependencyValidationException(randomMessage, innerException),
new PropertyValidationException(randomMessage,innerException),
new PropertyDependencyValidationException(randomMessage, innerException),
};
}

Expand All @@ -80,10 +80,10 @@ public static TheoryData DependencyExceptions()

return new TheoryData<Xeption>
{
new TypeDependencyException(innerException),
new TypeServiceException(innerException),
new PropertyDependencyException(innerException),
new PropertyServiceException(innerException)
new TypeDependencyException(randomMessage, innerException),
new TypeServiceException(randomMessage, innerException),
new PropertyDependencyException(randomMessage, innerException),
new PropertyServiceException(randomMessage, innerException)
};
}
}
Expand Down
3 changes: 3 additions & 0 deletions RESTFulSense/Clients/RESTFulApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,19 @@ public async ValueTask<TResult> PostFormAsync<TContent, TResult>(
catch (FormCoordinationValidationException formCoordinationValidationException)
{
throw new RESTFulApiClientValidationException(
message: "Api Client validation errors occurred, please try again.",
formCoordinationValidationException.InnerException as Xeption);
}
catch (FormCoordinationDependencyException formCoordinationDependencyException)
{
throw new RESTFulApiClientDependencyException(
message: "Form coordination dependency error occurred, fix the errors and try again.",
formCoordinationDependencyException.InnerException as Xeption);
}
catch (FormCoordinationServiceException formCoordinationServiceException)
{
throw new RESTFulApiClientServiceException(
message: "Api Client error occurred, contact support.",
formCoordinationServiceException.InnerException as Xeption);
}
}
Expand Down
3 changes: 3 additions & 0 deletions RESTFulSense/Clients/RESTFulApiFactoryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,19 @@ await this.httpClient.PostAsync(
catch (FormCoordinationValidationException formCoordinationValidationException)
{
throw new RESTFulApiClientValidationException(
message: "Api Client validation errors occurred, please try again.",
formCoordinationValidationException.InnerException as Xeption);
}
catch (FormCoordinationDependencyException formCoordinationDependencyException)
{
throw new RESTFulApiClientDependencyException(
message: "Form coordination dependency error occurred, fix the errors and try again.",
formCoordinationDependencyException.InnerException as Xeption);
}
catch (FormCoordinationServiceException formCoordinationServiceException)
{
throw new RESTFulApiClientServiceException(
message: "Api Client error occurred, contact support.",
formCoordinationServiceException.InnerException as Xeption);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Client.Exceptions
{
public class RESTFulApiClientDependencyException : Xeption
{
public RESTFulApiClientDependencyException(Xeption innerException)
: base(
message: "Form coordination dependency error occurred, fix the errors and try again.",
innerException: innerException)
{ }

public RESTFulApiClientDependencyException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Client.Exceptions
{
public class RESTFulApiClientServiceException : Xeption
{
public RESTFulApiClientServiceException(Xeption innerException)
: base(
message: "Api Client error occurred, contact support.",
innerException: innerException)
{ }

public RESTFulApiClientServiceException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ namespace RESTFulSense.Models.Client.Exceptions
{
public class RESTFulApiClientValidationException : Xeption
{
public RESTFulApiClientValidationException(Xeption innerException)
: base(
message: "Api Client validation errors occurred, please try again.",
innerException: innerException)
{ }

public RESTFulApiClientValidationException(string message, Xeption innerException)
: base(message, innerException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ namespace RESTFulSense.Models.Coordinations.Forms.Exceptions
{
public class FailedFormCoordinationServiceException : Xeption
{
public FailedFormCoordinationServiceException(Exception innerException)
: base(
message: "Form coordination service error occurred, contact support.",
innerException: innerException)
{ }

public FailedFormCoordinationServiceException(string message, Exception innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ namespace RESTFulSense.Models.Coordinations.Forms.Exceptions
{
public class FormCoordinationDependencyException : Xeption
{
public FormCoordinationDependencyException(Xeption innerException)
: base(
message: "Form coordination dependency error occurred, fix the errors and try again.",
innerException: innerException)
{ }


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra empty line

public FormCoordinationDependencyException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Coordinations.Forms.Exceptions
{
public class FormCoordinationDependencyValidationException : Xeption
{
public FormCoordinationDependencyValidationException(Xeption innerException)
: base(
message: "Form coordination dependency validation error occurred, fix the errors and try again.",
innerException: innerException)
{ }

public FormCoordinationDependencyValidationException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Coordinations.Forms.Exceptions
{
public class FormCoordinationServiceException : Xeption
{
public FormCoordinationServiceException(Xeption innerException)
: base(
message: "Form coordination service error occurred, contact support.",
innerException: innerException)
{ }

public FormCoordinationServiceException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Coordinations.Forms.Exceptions
{
public class FormCoordinationValidationException : Xeption
{
public FormCoordinationValidationException(Xeption innerException)
: base(
message: "Form coordination validation errors occurred, please try again.",
innerException: innerException)
{ }

public FormCoordinationValidationException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ namespace RESTFulSense.Models.Coordinations.Forms.Exceptions
{
public class NullObjectException : Xeption
{
public NullObjectException()
: base(message: "Object is null.")
{ }

public NullObjectException(string message)
: base(message)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Foundations.Attributes.Exceptions
{
public class AttributeDependencyException : Xeption
{
public AttributeDependencyException(Xeption innerException) :
base(
message: "Attribute dependency error occurred, contact support.",
innerException: innerException)
{ }

public AttributeDependencyException(string message, Xeption innerException) :
base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ namespace RESTFulSense.Models.Foundations.Attributes.Exceptions
{
public class AttributeDependencyValidationException : Xeption
{
public AttributeDependencyValidationException(Exception innerException)
: base(
message: "Attribute dependency validation error occurred, fix errors and try again.",
innerException: innerException)
{ }

public AttributeDependencyValidationException(string message, Exception innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Foundations.Attributes.Exceptions
{
public class AttributeServiceException : Xeption
{
public AttributeServiceException(Xeption innerException)
: base(
message: "Attribute service error occurred, contact support.",
innerException: innerException)
{ }

public AttributeServiceException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ namespace RESTFulSense.Models.Foundations.Attributes.Exceptions
{
public class AttributeValidationException : Xeption
{
public AttributeValidationException(Xeption innerException)
: base(
message: "Attribute validation error occurred, fix errors and try again.",
innerException: innerException)
{ }

public AttributeValidationException(string message, Xeption innerException)
: base(message, innerException)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ namespace RESTFulSense.Models.Foundations.Properties.Exceptions
{
public class FailedAttributeServiceException : Xeption
{
public FailedAttributeServiceException(Exception innerException)
: base(
message: "Failed Attribute Service Exception occurred, please contact support for assistance.",
innerException: innerException)
{ }

public FailedAttributeServiceException(string message, Exception innerException)
: base(message, innerException)
{ }
Expand Down
Loading