Skip to content

Commit

Permalink
Removed create method in the unit test class and refactored code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lezune committed Jun 13, 2024
1 parent b9c2df9 commit 8e399f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsNullAsync()
invalidChatCompletion.Request = null;

var invalidChatCompletionException =
createInvalidChatCompletionException();
new InvalidChatCompletionException(
message: "Chat completion is invalid."); ;

invalidChatCompletionException.AddData(
key: nameof(ChatCompletion.Request),
Expand Down Expand Up @@ -107,7 +108,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsInvalidAsync(s
};

var invalidChatCompletionException =
createInvalidChatCompletionException();
new InvalidChatCompletionException(
message: "Chat completion is invalid.");

invalidChatCompletionException.AddData(
key: nameof(ChatCompletion.Request.Model),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,5 @@ private static Filler<ChatCompletion> ChatCompletionFiller()

return filler;
}

private static InvalidChatCompletionException createInvalidChatCompletionException()
{
return new InvalidChatCompletionException(
message: "Chat completion is invalid.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ private async ValueTask<ChatCompletion> TryCatch(
private static ChatCompletionValidationException CreateChatCompletionValidationException(
Xeption innerException)
{

return new ChatCompletionValidationException(
message: "Chat completion validation error occurred, fix errors and try again.",
innerException);
Expand All @@ -127,7 +126,6 @@ private static ChatCompletionValidationException CreateChatCompletionValidationE
private static ChatCompletionDependencyException CreateChatCompletionDependencyException(
Xeption innerException)
{

return new ChatCompletionDependencyException(
message: "Chat completion dependency error occurred, contact support.",
innerException);
Expand All @@ -136,7 +134,6 @@ private static ChatCompletionDependencyException CreateChatCompletionDependencyE
private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException(
Xeption innerException)
{

return new ChatCompletionDependencyValidationException(
"Chat completion dependency validation error occurred, fix errors and try again.",
innerException);
Expand All @@ -145,7 +142,6 @@ private static ChatCompletionDependencyValidationException CreateChatCompletionD
private static ChatCompletionServiceException CreateChatCompletionServiceException(
Xeption innerException)
{

return new ChatCompletionServiceException(
message: "Chat completion service error occurred, contact support.",
innerException);
Expand Down

0 comments on commit 8e399f7

Please sign in to comment.