@@ -14,6 +14,12 @@ public void PerformAnalysis_ShouldReturnCorrectAnalysisResult()
14
14
var basePath = FileUtils . GetBasePath ( ) ;
15
15
var solutionPath = Path . GetFullPath ( Path . Combine ( basePath , ".." , ".." , ".." , ".." ) ) ;
16
16
solutionPath = Path . Combine ( solutionPath , "CodeLineCounter.sln" ) ;
17
+ var sw = new StringWriter ( ) ;
18
+ Console . SetOut ( sw ) ;
19
+ Console . WriteLine ( $ "Constructed solution path: { solutionPath } ") ;
20
+ Assert . True ( File . Exists ( solutionPath ) , $ "The solution file '{ solutionPath } ' does not exist.") ;
21
+ Console . WriteLine ( $ "Constructed solution path: { solutionPath } ") ;
22
+ Assert . True ( File . Exists ( solutionPath ) , $ "The solution file '{ solutionPath } ' does not exist.") ;
17
23
18
24
// Act
19
25
var result = SolutionAnalyzer . PerformAnalysis ( solutionPath ) ;
@@ -34,6 +40,7 @@ public void OutputAnalysisResults_ShouldPrintCorrectOutput()
34
40
TotalLines = 1000 ,
35
41
TotalFiles = 10 ,
36
42
DuplicationMap = new List < DuplicationCode > ( ) ,
43
+ DependencyList = new List < DependencyRelation > ( ) ,
37
44
ProcessingTime = TimeSpan . FromSeconds ( 10 ) ,
38
45
SolutionFileName = "CodeLineCounter.sln" ,
39
46
DuplicatedLines = 100
@@ -109,5 +116,39 @@ public void OutputDetailedMetrics_ShouldPrintMetricsAndProjectTotals()
109
116
}
110
117
}
111
118
119
+ // Export metrics, duplications and dependencies data in parallel for valid input
120
+ [ Fact ]
121
+ public void export_results_with_valid_input_exports_all_files ( )
122
+ {
123
+ // Arrange
124
+ var result = new AnalysisResult
125
+ {
126
+ SolutionFileName = "TestSolution" ,
127
+ Metrics = new List < NamespaceMetrics > ( ) ,
128
+ ProjectTotals = new Dictionary < string , int > ( ) ,
129
+ TotalLines = 1000 ,
130
+ DuplicationMap = new List < DuplicationCode > ( ) ,
131
+ DependencyList = new List < DependencyRelation > ( )
132
+ } ;
133
+
134
+ var basePath = FileUtils . GetBasePath ( ) ;
135
+ var solutionPath = Path . GetFullPath ( Path . Combine ( basePath , ".." , ".." , ".." , ".." ) ) ;
136
+
137
+ solutionPath = Path . Combine ( solutionPath , "TestSolution.sln" ) ;
138
+ var format = CoreUtils . ExportFormat . CSV ;
139
+
140
+ // Act
141
+ using ( var sw = new StringWriter ( ) )
142
+ {
143
+ Console . SetOut ( sw ) ;
144
+ SolutionAnalyzer . ExportResults ( result , solutionPath , format ) ;
145
+ }
146
+
147
+ // Assert
148
+ Assert . True ( File . Exists ( "TestSolution-CodeMetrics.csv" ) ) ;
149
+ Assert . True ( File . Exists ( "TestSolution-CodeDuplications.csv" ) ) ;
150
+ Assert . True ( File . Exists ( "TestSolution-CodeDependencies.csv" ) ) ;
151
+ }
152
+
112
153
}
113
154
}
0 commit comments