From 84a8485b0ef5ba0341474febbe694166b86e8de4 Mon Sep 17 00:00:00 2001 From: Viji Date: Fri, 4 Oct 2024 09:18:34 +0530 Subject: [PATCH] UT code addition --- .../PackageUploaderTest.cs | 18 ++++++++++-------- src/ArtifactoryUploader/PackageUploader.cs | 2 +- .../patched-file_022.tar.gz | 12 ++++++++++++ .../DebianPackageDownloaderTest.cs | 2 ++ .../LCT.SW360PackageCreator.UTest.csproj | 3 +++ 5 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 src/LCT.SW360PackageCreator.UTest/ComponentCreatorUTFiles/patched-file_022.tar.gz diff --git a/src/AritfactoryUploader.UTest/PackageUploaderTest.cs b/src/AritfactoryUploader.UTest/PackageUploaderTest.cs index 65ee66e0..77da34c9 100644 --- a/src/AritfactoryUploader.UTest/PackageUploaderTest.cs +++ b/src/AritfactoryUploader.UTest/PackageUploaderTest.cs @@ -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() @@ -140,12 +147,7 @@ public void DisplayAllSettings_GivenListOfComponents_ReturnPackageSettings() Version="1.0.0", Properties=new List() { - 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} } } }; @@ -153,7 +155,7 @@ public void DisplayAllSettings_GivenListOfComponents_ReturnPackageSettings() PackageUploader.DisplayAllSettings(m_ComponentsInBOM, CommonAppSettings); //Assert - Assert.IsTrue(true); + Assert.Pass(); } diff --git a/src/ArtifactoryUploader/PackageUploader.cs b/src/ArtifactoryUploader/PackageUploader.cs index 9e9a9459..398beeb6 100644 --- a/src/ArtifactoryUploader/PackageUploader.cs +++ b/src/ArtifactoryUploader/PackageUploader.cs @@ -120,7 +120,7 @@ public static void DisplayAllSettings(List m_ComponentsInBOM, CommonA break; default: - Logger.Error($"DiplayAllSettings():Invalid ProjectType - {type}"); + Logger.ErrorFormat("DiplayAllSettings():Invalid ProjectType - {0}",type); break; } diff --git a/src/LCT.SW360PackageCreator.UTest/ComponentCreatorUTFiles/patched-file_022.tar.gz b/src/LCT.SW360PackageCreator.UTest/ComponentCreatorUTFiles/patched-file_022.tar.gz new file mode 100644 index 00000000..19f7d40b --- /dev/null +++ b/src/LCT.SW360PackageCreator.UTest/ComponentCreatorUTFiles/patched-file_022.tar.gz @@ -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 + { + } +} diff --git a/src/LCT.SW360PackageCreator.UTest/DebianPackageDownloaderTest.cs b/src/LCT.SW360PackageCreator.UTest/DebianPackageDownloaderTest.cs index 71a27442..ed1365be 100644 --- a/src/LCT.SW360PackageCreator.UTest/DebianPackageDownloaderTest.cs +++ b/src/LCT.SW360PackageCreator.UTest/DebianPackageDownloaderTest.cs @@ -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 diff --git a/src/LCT.SW360PackageCreator.UTest/LCT.SW360PackageCreator.UTest.csproj b/src/LCT.SW360PackageCreator.UTest/LCT.SW360PackageCreator.UTest.csproj index abd59ae0..69e98b2b 100644 --- a/src/LCT.SW360PackageCreator.UTest/LCT.SW360PackageCreator.UTest.csproj +++ b/src/LCT.SW360PackageCreator.UTest/LCT.SW360PackageCreator.UTest.csproj @@ -37,6 +37,9 @@ Always + + Always + Always