Skip to content

Commit

Permalink
UT code addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Viji committed Oct 4, 2024
1 parent f6f4103 commit 84a8485
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/AritfactoryUploader.UTest/PackageUploaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ public async Task UploadPackageToArtifactory_GivenAppsettings()
}

[Test]
public void DisplayAllSettings_GivenListOfComponents_ReturnPackageSettings()
[TestCase("NPM")]
[TestCase("CONAN")]
[TestCase("NUGET")]
[TestCase("MAVEN")]
[TestCase("DEBIAN")]
[TestCase("PYTHON")]
[TestCase("tes")]
public void DisplayAllSettings_GivenListOfComponents_ReturnPackageSettings(string type)
{
//Arrange
CommonAppSettings CommonAppSettings = new CommonAppSettings()
Expand Down Expand Up @@ -140,20 +147,15 @@ public void DisplayAllSettings_GivenListOfComponents_ReturnPackageSettings()
Version="1.0.0",
Properties=new List<Property>()
{
new Property{Name=Dataconstant.Cdx_ProjectType,Value="NPM"},
new Property{Name=Dataconstant.Cdx_ProjectType,Value="CONAN"},
new Property{Name=Dataconstant.Cdx_ProjectType,Value="NUGET"},
new Property{Name=Dataconstant.Cdx_ProjectType,Value="MAVEN"},
new Property{Name=Dataconstant.Cdx_ProjectType,Value="DEBIAN"},
new Property{Name=Dataconstant.Cdx_ProjectType,Value="PYTHON"}
new Property{Name=Dataconstant.Cdx_ProjectType,Value=type}
}
}
};
//Act
PackageUploader.DisplayAllSettings(m_ComponentsInBOM, CommonAppSettings);

//Assert
Assert.IsTrue(true);
Assert.Pass();
}


Expand Down
2 changes: 1 addition & 1 deletion src/ArtifactoryUploader/PackageUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static void DisplayAllSettings(List<Component> m_ComponentsInBOM, CommonA
break;

default:
Logger.Error($"DiplayAllSettings():Invalid ProjectType - {type}");
Logger.ErrorFormat("DiplayAllSettings():Invalid ProjectType - {0}",type);
break;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LCT.SW360PackageCreator.UTest.ComponentCreatorUTFiles
{
class patched_file_022
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;

namespace LCT.SW360PackageCreator.UTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<None Update="ComponentCreatorUTFiles\Attachment.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ComponentCreatorUTFiles\patched-file_022.tar.gz">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ComponentCreatorUTFiles\TestComponent-1.0-sources.jar">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down

0 comments on commit 84a8485

Please sign in to comment.