Fixing coverage - 9

This commit is contained in:
2024-05-13 01:13:09 +02:00
parent 277d6b99fd
commit 57391d3e51

View File

@@ -63,9 +63,9 @@ public class ProgramUtils_Tests
{ {
OpenApiInfo expectedOpenApiInfo = new OpenApiInfo() OpenApiInfo expectedOpenApiInfo = new OpenApiInfo()
{ {
Title = "", Title = null,
Description = "", Description = null,
Version = "", Version = null,
Contact = null, Contact = null,
TermsOfService = null, TermsOfService = null,
License = null, License = null,
@@ -109,6 +109,35 @@ public class ProgramUtils_Tests
} }
} }
[TestMethod]
public void CreateOpenApiInfo_NullOpenApiSettings()
{
try
{
AppSettings appSettings = new AppSettings()
{
Settings = new Settings
{
Name = "Test",
Description = "This is a test description",
Version = "v1"
},
OpenApiSettings = null
};
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
Assert.IsTrue(realOpenApiInfo != null);
Assert.IsTrue(realOpenApiInfo.Title == appSettings.Settings.Name);
Assert.IsTrue(realOpenApiInfo.Description == appSettings.Settings.Description);
Assert.IsTrue(realOpenApiInfo.Version == appSettings.Settings.Version);
}
catch (Exception ex)
{
Console.WriteLine(ex.InnerException);
Assert.Fail($"An exception was thrown: {ex.Message}");
}
}
[TestMethod] [TestMethod]
public void OpenApiConfig_NotNull() public void OpenApiConfig_NotNull()
{ {