-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from jodendaal/CorrectNamingOfVariables
Correct naming of variables
- Loading branch information
Showing
50 changed files
with
559 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
using OpenAI.Net.Models; | ||
using OpenAI.Net.Models.Requests; | ||
using System.Net; | ||
|
||
namespace OpenAI.Net.Integration.Tests | ||
{ | ||
internal class ImageService_Edit : BaseTest | ||
{ | ||
[TestCase(true, HttpStatusCode.OK, "256x256", TestName = "Edit_When_Success")] | ||
[TestCase(false, HttpStatusCode.BadRequest, "32x32", TestName = "Edit_When_Invalid_Size_Fail")] | ||
public async Task Edit(bool isSuccess,HttpStatusCode statusCode, string size) | ||
{ | ||
|
||
var image = FileContentInfo.Load(@"Images\RGBAImage.png"); | ||
var request = new ImageEditRequest("A cute baby sea otter with hat", image) { N = 1, Size = size}; | ||
|
||
var response = await OpenAIService.Images.Edit(request); | ||
|
||
Assert.That(response.IsSuccess, Is.EqualTo(isSuccess), "Request failed"); | ||
Assert.That(response.StatusCode, Is.EqualTo(statusCode)); | ||
Assert.That(response.Result?.Data?.Count() == 1, Is.EqualTo(isSuccess), "Data is not mapped correctly"); | ||
Assert.That(response.Result?.Data?[0].Url?.Contains("https://"), isSuccess ? Is.EqualTo(isSuccess) : Is.EqualTo(null), "Choice text not set"); | ||
Assert.That(response.ErrorResponse?.Error?.Message?.Contains("is not one of ['256x256', '512x512', '1024x1024']"), isSuccess ? Is.EqualTo(null) : Is.EqualTo(true), "Error message not returned"); | ||
} | ||
|
||
[TestCase(true, HttpStatusCode.OK, "256x256",TestName = "EditWithMask_When_Success")] | ||
[TestCase(false, HttpStatusCode.BadRequest, "32x32", TestName = "EditWithMask_When_Invalid_Size_Fail")] | ||
public async Task EditWithMask(bool isSuccess, HttpStatusCode statusCode, string size) | ||
{ | ||
|
||
var image = FileContentInfo.Load(@"Images\BabyCat.png"); | ||
var mask = FileContentInfo.Load(@"Images\RGBAImage.png"); | ||
var request = new ImageEditRequest("A cute baby sea otter with hat", image) { N = 1, Size = size, Mask = mask }; | ||
|
||
var response = await OpenAIService.Images.Edit(request); | ||
|
||
Assert.That(response.IsSuccess, Is.EqualTo(isSuccess), "Request failed"); | ||
Assert.That(response.StatusCode, Is.EqualTo(statusCode)); | ||
Assert.That(response.Result?.Data?.Count() == 1, Is.EqualTo(isSuccess), "Data is not mapped correctly"); | ||
Assert.That(response.Result?.Data?[0].Url?.Contains("https://"), isSuccess ? Is.EqualTo(isSuccess) : Is.EqualTo(null), "Choice text not set"); | ||
Assert.That(response.ErrorResponse?.Error?.Message?.Contains("is not one of ['256x256', '512x512', '1024x1024']"), isSuccess ? Is.EqualTo(null) : Is.EqualTo(true), "Error message not returned"); | ||
} | ||
} | ||
} | ||
using OpenAI.Net.Models; | ||
using OpenAI.Net.Models.Requests; | ||
using System.Net; | ||
|
||
namespace OpenAI.Net.Integration.Tests | ||
{ | ||
internal class ImageService_Edit : BaseTest | ||
{ | ||
[TestCase(true, HttpStatusCode.OK, "256x256", TestName = "Edit_When_Success")] | ||
[TestCase(false, HttpStatusCode.BadRequest, "32x32", TestName = "Edit_When_Invalid_Size_Fail")] | ||
public async Task Edit(bool isSuccess,HttpStatusCode statusCode, string size) | ||
{ | ||
|
||
var image = FileContentInfo.Load(@"Images\RGBAImage.png"); | ||
var request = new ImageEditRequest("A cute baby sea otter with hat", image) { N = 1, Size = size}; | ||
|
||
var response = await OpenAIService.Images.Edit(request); | ||
|
||
Assert.That(response.IsSuccess, Is.EqualTo(isSuccess), "Request failed"); | ||
Assert.That(response.StatusCode, Is.EqualTo(statusCode)); | ||
Assert.That(response.Result?.Data?.Count() == 1, Is.EqualTo(isSuccess), "Data is not mapped correctly"); | ||
Assert.That(response.Result?.Data?[0].Url?.Contains("https://"), isSuccess ? Is.EqualTo(isSuccess) : Is.EqualTo(null), "Choice text not set"); | ||
Assert.That(response.ErrorResponse?.Error?.Message?.Contains("is not one of ['256x256', '512x512', '1024x1024']"), isSuccess ? Is.EqualTo(null) : Is.EqualTo(true), "Error message not returned"); | ||
} | ||
|
||
[TestCase(true, HttpStatusCode.OK, "256x256",TestName = "EditWithMask_When_Success")] | ||
[TestCase(false, HttpStatusCode.BadRequest, "32x32", TestName = "EditWithMask_When_Invalid_Size_Fail")] | ||
public async Task EditWithMask(bool isSuccess, HttpStatusCode statusCode, string size) | ||
{ | ||
|
||
var image = FileContentInfo.Load(@"Images\BabyCat.png"); | ||
var mask = FileContentInfo.Load(@"Images\RGBAImage.png"); | ||
var request = new ImageEditRequest("A cute baby sea otter with hat", image) { N = 1, Size = size, Mask = mask }; | ||
|
||
var response = await OpenAIService.Images.Edit(request); | ||
|
||
Assert.That(response.IsSuccess, Is.EqualTo(isSuccess), "Request failed"); | ||
Assert.That(response.StatusCode, Is.EqualTo(statusCode)); | ||
Assert.That(response.Result?.Data?.Count() == 1, Is.EqualTo(isSuccess), "Data is not mapped correctly"); | ||
Assert.That(response.Result?.Data?[0].Url?.Contains("https://"), isSuccess ? Is.EqualTo(isSuccess) : Is.EqualTo(null), "Choice text not set"); | ||
Assert.That(response.ErrorResponse?.Error?.Message?.Contains("is not one of ['256x256', '512x512', '1024x1024']"), isSuccess ? Is.EqualTo(null) : Is.EqualTo(true), "Error message not returned"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.