@@ -34,110 +34,102 @@ public void SetUp()
34
34
[ TestCase ( "B.fsproj" ) ]
35
35
[ TestCase ( "C.vbproj" ) ]
36
36
[ TestCase ( "D.dbproj" ) ]
37
- public void GetProjects_Should_ReturnProjectsAsListDirectly ( string projectFile )
37
+ public async Task GetProjects_Should_ReturnProjectsAsListDirectly ( string projectFile )
38
38
{
39
- IEnumerable < string > result = _uut . GetProjects ( projectFile ) ;
39
+ IEnumerable < string > result = await _uut . GetProjectsAsync ( projectFile ) ;
40
40
Assert . That ( result , Is . EqualTo ( new [ ] { Path . GetFullPath ( projectFile ) } ) ) ;
41
- _msBuild . DidNotReceive ( ) . GetProjectsFromSolution ( Arg . Any < string > ( ) ) ;
41
+ await _msBuild . DidNotReceive ( ) . GetProjectsFromSolutionAsync ( Arg . Any < string > ( ) ) ;
42
42
}
43
43
44
44
[ TestCase ( "A.sln" ) ]
45
45
[ TestCase ( "B.sln" ) ]
46
46
[ TestCase ( "C.sln" ) ]
47
47
[ TestCase ( "A.slnx" ) ]
48
- public void GetProjects_Should_QueryMsBuildToGetProjectsForSolutionFiles ( string solutionFile )
48
+ public async Task GetProjects_Should_QueryMsBuildToGetProjectsForSolutionFiles ( string solutionFile )
49
49
{
50
- _ = _uut . GetProjects ( solutionFile ) ;
50
+ _ = await _uut . GetProjectsAsync ( solutionFile ) ;
51
51
52
- _msBuild . Received ( 1 ) . GetProjectsFromSolution ( Path . GetFullPath ( solutionFile ) ) ;
52
+ await _msBuild . Received ( 1 ) . GetProjectsFromSolutionAsync ( Path . GetFullPath ( solutionFile ) ) ;
53
53
}
54
54
55
55
[ TestCase ( "A.sln" ) ]
56
56
[ TestCase ( "B.sln" ) ]
57
57
[ TestCase ( "C.sln" ) ]
58
58
[ TestCase ( "C.slnx" ) ]
59
- public void GetProjects_Should_ReturnEmptyArray_If_SolutionContainsNoProjects ( string solutionFile )
59
+ public async Task GetProjects_Should_ReturnEmptyArray_If_SolutionContainsNoProjects ( string solutionFile )
60
60
{
61
- _msBuild . GetProjectsFromSolution ( Arg . Any < string > ( ) ) . Returns ( Enumerable . Empty < string > ( ) ) ;
61
+ _msBuild . GetProjectsFromSolutionAsync ( Arg . Any < string > ( ) ) . Returns ( Task . FromResult ( Enumerable . Empty < string > ( ) ) ) ;
62
62
63
- IEnumerable < string > result = _uut . GetProjects ( solutionFile ) ;
63
+ IEnumerable < string > result = await _uut . GetProjectsAsync ( solutionFile ) ;
64
64
Assert . That ( result , Is . Empty ) ;
65
65
66
- _msBuild . Received ( 1 ) . GetProjectsFromSolution ( Path . GetFullPath ( solutionFile ) ) ;
66
+ await _msBuild . Received ( 1 ) . GetProjectsFromSolutionAsync ( Path . GetFullPath ( solutionFile ) ) ;
67
67
}
68
68
69
69
[ TestCase ( "A.sln" ) ]
70
70
[ TestCase ( "B.sln" ) ]
71
71
[ TestCase ( "C.sln" ) ]
72
72
[ TestCase ( "B.slnx" ) ]
73
- public void GetProjects_Should_ReturnEmptyArray_If_SolutionContainsProjectsThatDontExist ( string solutionFile )
73
+ public async Task GetProjects_Should_ReturnEmptyArray_If_SolutionContainsProjectsThatDontExist ( string solutionFile )
74
74
{
75
75
IEnumerable < string > projects = _fixture . CreateMany < string > ( ) ;
76
- _msBuild . GetProjectsFromSolution ( Arg . Any < string > ( ) ) . Returns ( projects ) ;
76
+ _msBuild . GetProjectsFromSolutionAsync ( Arg . Any < string > ( ) ) . Returns ( Task . FromResult ( projects ) ) ;
77
77
78
- IEnumerable < string > result = _uut . GetProjects ( solutionFile ) ;
78
+ IEnumerable < string > result = await _uut . GetProjectsAsync ( solutionFile ) ;
79
79
Assert . That ( result , Is . Empty ) ;
80
80
81
- _msBuild . Received ( 1 ) . GetProjectsFromSolution ( Path . GetFullPath ( solutionFile ) ) ;
81
+ await _msBuild . Received ( 1 ) . GetProjectsFromSolutionAsync ( Path . GetFullPath ( solutionFile ) ) ;
82
82
}
83
83
84
84
[ TestCase ( "A.sln" ) ]
85
85
[ TestCase ( "B.sln" ) ]
86
86
[ TestCase ( "C.sln" ) ]
87
87
[ TestCase ( "C.slnx" ) ]
88
- public void GetProjects_Should_ReturnArrayOfProjects_If_SolutionContainsProjectsThatDoExist ( string solutionFile )
88
+ public async Task GetProjects_Should_ReturnArrayOfProjects_If_SolutionContainsProjectsThatDoExist ( string solutionFile )
89
89
{
90
90
string [ ] projects = _fixture . CreateMany < string > ( ) . ToArray ( ) ;
91
91
CreateFiles ( projects ) ;
92
- _msBuild . GetProjectsFromSolution ( Arg . Any < string > ( ) ) . Returns ( projects ) ;
92
+ _msBuild . GetProjectsFromSolutionAsync ( Arg . Any < string > ( ) ) . Returns ( Task . FromResult < IEnumerable < string > > ( projects ) ) ;
93
93
94
- IEnumerable < string > result = _uut . GetProjects ( solutionFile ) ;
94
+ IEnumerable < string > result = await _uut . GetProjectsAsync ( solutionFile ) ;
95
95
Assert . That ( result , Is . EqualTo ( projects . Select ( Path . GetFullPath ) ) ) ;
96
96
97
- _msBuild . Received ( 1 ) . GetProjectsFromSolution ( Path . GetFullPath ( solutionFile ) ) ;
97
+ await _msBuild . Received ( 1 ) . GetProjectsFromSolutionAsync ( Path . GetFullPath ( solutionFile ) ) ;
98
98
}
99
99
100
100
[ TestCase ( "A.sln" ) ]
101
101
[ TestCase ( "B.sln" ) ]
102
102
[ TestCase ( "C.sln" ) ]
103
103
[ TestCase ( "A.slnx" ) ]
104
- public void GetProjects_Should_ReturnOnlyExistingProjectsInSolutionFile ( string solutionFile )
104
+ public async Task GetProjects_Should_ReturnOnlyExistingProjectsInSolutionFile ( string solutionFile )
105
105
{
106
106
string [ ] existingProjects = _fixture . CreateMany < string > ( ) . ToArray ( ) ;
107
107
IEnumerable < string > missingProjects = _fixture . CreateMany < string > ( ) ;
108
108
109
109
CreateFiles ( existingProjects ) ;
110
110
111
- _msBuild . GetProjectsFromSolution ( Arg . Any < string > ( ) )
111
+ _msBuild . GetProjectsFromSolutionAsync ( Arg . Any < string > ( ) )
112
112
. Returns ( existingProjects . Concat ( missingProjects ) . Shuffle ( 54321 ) ) ;
113
113
114
- IEnumerable < string > result = _uut . GetProjects ( solutionFile ) ;
114
+ IEnumerable < string > result = await _uut . GetProjectsAsync ( solutionFile ) ;
115
115
Assert . That ( result , Is . EquivalentTo ( existingProjects . Select ( Path . GetFullPath ) ) ) ;
116
116
117
- _msBuild . Received ( 1 ) . GetProjectsFromSolution ( Path . GetFullPath ( solutionFile ) ) ;
117
+ await _msBuild . Received ( 1 ) . GetProjectsFromSolutionAsync ( Path . GetFullPath ( solutionFile ) ) ;
118
118
}
119
119
120
120
[ Test ]
121
121
public async Task GetProjectsFromSolution_Should_ReturnProjectsInActualSolutionFileRelativePath ( )
122
122
{
123
123
var msbuild = new MsBuildAbstraction ( ) ;
124
- IEnumerable < string > result = msbuild . GetProjectsFromSolution ( "../../../../targets/Projects.sln" ) ;
125
- await Verify ( string . Join ( "," , result ) , _osPlatformSpecificVerifySettings ) ;
126
- }
127
-
128
- [ Test , Ignore ( "Ignore this specific test as long as msbuild does not fully support slnx solutions everywhere" ) ]
129
- public async Task GetProjectsFromXmlSolution_Should_ReturnProjectsInActualSolutionFileRelativePath ( )
130
- {
131
- var msbuild = new MsBuildAbstraction ( ) ;
132
- IEnumerable < string > result = msbuild . GetProjectsFromSolution ( "../../../../targets/slnx/slnx.slnx" ) ;
124
+ IEnumerable < string > result = await msbuild . GetProjectsFromSolutionAsync ( "../../../../targets/Projects.sln" ) ;
133
125
await Verify ( string . Join ( "," , result ) , _osPlatformSpecificVerifySettings ) ;
134
126
}
135
127
136
128
[ Test ]
137
- public async Task GetProjectsFromSolution_Should_ReturnProjectsInActualSolutionFileAbsolutePath ( )
129
+ public async Task GetProjectsFromXmlSolution_Should_ReturnProjectsInActualSolutionFileRelativePath ( )
138
130
{
139
131
var msbuild = new MsBuildAbstraction ( ) ;
140
- IEnumerable < string > result = msbuild . GetProjectsFromSolution ( Path . GetFullPath ( "../../../../targets/Projects.sln" ) ) ;
132
+ IEnumerable < string > result = await msbuild . GetProjectsFromSolutionAsync ( "../../../../targets/slnx/slnx.slnx" ) ;
141
133
await Verify ( string . Join ( "," , result ) , _osPlatformSpecificVerifySettings ) ;
142
134
}
143
135
0 commit comments