66
77using LCT . APICommunications ;
88using LCT . APICommunications . Model ;
9- using LCT . ArtifactoryUploader ;
109using LCT . ArtifactoryUploader . Model ;
1110using LCT . Common ;
1211using LCT . Common . Constants ;
1312using LCT . Common . Interface ;
14- using log4net ;
1513using log4net . Appender ;
1614using log4net . Config ;
1715using log4net . Core ;
@@ -31,7 +29,7 @@ public class PackageUploadInformationTest
3129
3230 [ SetUp ]
3331 public void SetUp ( )
34- {
32+ {
3533 _memoryAppender = new MemoryAppender ( ) ;
3634 BasicConfigurator . Configure ( _memoryAppender ) ;
3735 _memoryAppender . Clear ( ) ;
@@ -833,9 +831,9 @@ public void DisplayWithLogger_WithAllPackageTypes_ShouldLogAllInformation()
833831
834832 var jfrogFoundPackages = new List < ComponentsToArtifactory >
835833 {
836- new ComponentsToArtifactory
837- {
838- Name = "FoundPkg" ,
834+ new ComponentsToArtifactory
835+ {
836+ Name = "FoundPkg" ,
839837 Version = "4.0.0" ,
840838 ResponseMessage = new HttpResponseMessage
841839 {
@@ -856,20 +854,20 @@ public void DisplayWithLogger_WithAllPackageTypes_ShouldLogAllInformation()
856854 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ) ;
857855
858856 // Act
859- method . Invoke ( null , new object [ ]
860- {
861- unknownPackages ,
862- jfrogNotFoundPackages ,
863- successfulPackages ,
864- jfrogFoundPackages ,
865- "TestPackageType" ,
866- filepath
857+ method . Invoke ( null , new object [ ]
858+ {
859+ unknownPackages ,
860+ jfrogNotFoundPackages ,
861+ successfulPackages ,
862+ jfrogFoundPackages ,
863+ "TestPackageType" ,
864+ filepath
867865 } ) ;
868866
869867 // Assert
870868 var events = _memoryAppender . GetEvents ( ) ;
871869 Assert . IsTrue ( events . Length > 0 , "Expected log events to be captured" ) ;
872-
870+
873871 var infoEvent = FindEventByLevel ( events , Level . Info ) ;
874872 Assert . IsNotNull ( infoEvent , "Expected Info level log event" ) ;
875873 StringAssert . Contains ( "TestPackageType" , infoEvent . RenderedMessage ) ;
@@ -886,20 +884,20 @@ public void DisplayWithLogger_WithEmptyPackageLists_ShouldLogName()
886884 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ) ;
887885
888886 // Act
889- method . Invoke ( null , new object [ ]
890- {
891- emptyList ,
892- emptyList ,
893- emptyList ,
894- emptyList ,
895- "EmptyPackageType" ,
896- filepath
887+ method . Invoke ( null , new object [ ]
888+ {
889+ emptyList ,
890+ emptyList ,
891+ emptyList ,
892+ emptyList ,
893+ "EmptyPackageType" ,
894+ filepath
897895 } ) ;
898896
899897 // Assert
900898 var events = _memoryAppender . GetEvents ( ) ;
901899 Assert . IsTrue ( events . Length > 0 , "Expected at least one log event" ) ;
902-
900+
903901 var infoEvent = FindEventByLevel ( events , Level . Info ) ;
904902 Assert . IsNotNull ( infoEvent , "Expected Info level log event" ) ;
905903 StringAssert . Contains ( "EmptyPackageType" , infoEvent . RenderedMessage ) ;
@@ -911,9 +909,9 @@ public void DisplayWithLogger_WithJfrogFoundPackagesErrorInUpload_ShouldLogError
911909 // Arrange
912910 var jfrogFoundPackages = new List < ComponentsToArtifactory >
913911 {
914- new ComponentsToArtifactory
915- {
916- Name = "FailedPkg" ,
912+ new ComponentsToArtifactory
913+ {
914+ Name = "FailedPkg" ,
917915 Version = "1.0.0" ,
918916 ResponseMessage = new HttpResponseMessage
919917 {
@@ -933,14 +931,14 @@ public void DisplayWithLogger_WithJfrogFoundPackagesErrorInUpload_ShouldLogError
933931 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ) ;
934932
935933 // Act
936- method . Invoke ( null , new object [ ]
937- {
938- emptyList ,
939- emptyList ,
940- emptyList ,
941- jfrogFoundPackages ,
942- "npm" ,
943- filepath
934+ method . Invoke ( null , new object [ ]
935+ {
936+ emptyList ,
937+ emptyList ,
938+ emptyList ,
939+ jfrogFoundPackages ,
940+ "npm" ,
941+ filepath
944942 } ) ;
945943
946944 // Assert
@@ -967,14 +965,14 @@ public void DisplayWithLogger_WithJfrogNotFoundPackages_ShouldLogWarning()
967965 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ) ;
968966
969967 // Act
970- method . Invoke ( null , new object [ ]
971- {
972- emptyList ,
973- jfrogNotFoundPackages ,
974- emptyList ,
975- emptyList ,
976- "NuGet" ,
977- filepath
968+ method . Invoke ( null , new object [ ]
969+ {
970+ emptyList ,
971+ jfrogNotFoundPackages ,
972+ emptyList ,
973+ emptyList ,
974+ "NuGet" ,
975+ filepath
978976 } ) ;
979977
980978 // Assert
@@ -1001,20 +999,20 @@ public void DisplayWithLogger_WithSuccessfulPackages_ShouldLogInfo()
1001999 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ) ;
10021000
10031001 // Act
1004- method . Invoke ( null , new object [ ]
1005- {
1006- emptyList ,
1007- emptyList ,
1008- successfulPackages ,
1009- emptyList ,
1010- "Maven" ,
1011- filepath
1002+ method . Invoke ( null , new object [ ]
1003+ {
1004+ emptyList ,
1005+ emptyList ,
1006+ successfulPackages ,
1007+ emptyList ,
1008+ "Maven" ,
1009+ filepath
10121010 } ) ;
10131011
10141012 // Assert
10151013 var events = _memoryAppender . GetEvents ( ) ;
10161014 Assert . IsTrue ( events . Length >= 2 , "Expected at least 2 log events" ) ;
1017-
1015+
10181016 // Check if any event contains the package name and success message
10191017 var packageEvent = FindEventContaining ( events , "UploadedPkg" ) ;
10201018 Assert . IsNotNull ( packageEvent , "Expected log event containing package name 'UploadedPkg'" ) ;
@@ -1042,9 +1040,9 @@ public void DisplayWithLogger_WithMultiplePackageTypes_ShouldCallAllDisplayMetho
10421040
10431041 var jfrogFoundPackages = new List < ComponentsToArtifactory >
10441042 {
1045- new ComponentsToArtifactory
1046- {
1047- Name = "FoundPkg" ,
1043+ new ComponentsToArtifactory
1044+ {
1045+ Name = "FoundPkg" ,
10481046 Version = "4.0.0" ,
10491047 ResponseMessage = new HttpResponseMessage
10501048 {
@@ -1064,24 +1062,24 @@ public void DisplayWithLogger_WithMultiplePackageTypes_ShouldCallAllDisplayMetho
10641062 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ) ;
10651063
10661064 // Act
1067- method . Invoke ( null , new object [ ]
1068- {
1069- unknownPackages ,
1070- jfrogNotFoundPackages ,
1071- successfulPackages ,
1072- jfrogFoundPackages ,
1073- "Python" ,
1074- filepath
1065+ method . Invoke ( null , new object [ ]
1066+ {
1067+ unknownPackages ,
1068+ jfrogNotFoundPackages ,
1069+ successfulPackages ,
1070+ jfrogFoundPackages ,
1071+ "Python" ,
1072+ filepath
10751073 } ) ;
10761074
10771075 // Assert
10781076 var events = _memoryAppender . GetEvents ( ) ;
10791077 Assert . IsTrue ( events . Length >= 4 , "Expected at least 4 log events (one for each package type)" ) ;
1080-
1078+
10811079 // Verify package type name is logged
10821080 var packageTypeEvent = FindEventContaining ( events , "Python" ) ;
10831081 Assert . IsNotNull ( packageTypeEvent , "Expected Python package type to be logged" ) ;
1084-
1082+
10851083 // Verify warning event for not found packages
10861084 var warnEvent = FindEventByLevel ( events , Level . Warn ) ;
10871085 Assert . IsNotNull ( warnEvent , "Expected warning for not found packages" ) ;
0 commit comments