1010
1111using Xamarin . ProjectTools ;
1212
13- namespace CodeBehindUnitTests
13+ namespace Xamarin . Android . Build . Tests
1414{
15- sealed class LocalBuilder : Builder
15+ [ Category ( "Node-2" ) ]
16+ [ Parallelizable ( ParallelScope . Children ) ]
17+ public class CodeBehindTests
1618 {
17- public LocalBuilder ( )
18- {
19- BuildingInsideVisualStudio = false ;
20- }
21-
22- public bool Build ( string projectOrSolution , string target , string [ ] parameters = null , Dictionary < string , string > environmentVariables = null )
19+ sealed class LocalBuilder : Builder
2320 {
24- return BuildInternal ( projectOrSolution , target , parameters , environmentVariables ) ;
25- }
26- }
21+ public LocalBuilder ( )
22+ {
23+ BuildingInsideVisualStudio = false ;
24+ }
2725
28- sealed class SourceFileMember
29- {
30- public string Visibility { get ; }
31- public string Type { get ; }
32- public string Name { get ; }
33- public string Arguments { get ; }
34- public bool IsExpressionBody { get ; }
35- public bool IsMethod { get ; }
36-
37- public SourceFileMember ( string visibility , string type , string name , bool isExpressionBody )
38- {
39- if ( String . IsNullOrEmpty ( visibility ) )
40- throw new ArgumentException ( nameof ( visibility ) ) ;
41- if ( String . IsNullOrEmpty ( type ) )
42- throw new ArgumentException ( nameof ( type ) ) ;
43- if ( String . IsNullOrEmpty ( name ) )
44- throw new ArgumentException ( nameof ( name ) ) ;
45- Visibility = visibility ;
46- Type = type ;
47- Name = name ;
48- IsExpressionBody = isExpressionBody ;
49- IsMethod = false ;
50- }
51-
52- public SourceFileMember ( string visibility , string type , string name , string arguments )
53- {
54- if ( String . IsNullOrEmpty ( visibility ) )
55- throw new ArgumentException ( nameof ( visibility ) ) ;
56- if ( String . IsNullOrEmpty ( type ) )
57- throw new ArgumentException ( nameof ( type ) ) ;
58- if ( String . IsNullOrEmpty ( name ) )
59- throw new ArgumentException ( nameof ( name ) ) ;
60- Visibility = visibility ;
61- Type = type ;
62- Name = name ;
63- Arguments = arguments ?? String . Empty ;
64- IsExpressionBody = false ;
65- IsMethod = true ;
26+ public bool Build ( string projectOrSolution , string target , string [ ] parameters = null , Dictionary < string , string > environmentVariables = null )
27+ {
28+ return BuildInternal ( projectOrSolution , target , parameters , environmentVariables ) ;
29+ }
6630 }
67- }
6831
69- sealed class SourceFile : IEnumerable < SourceFileMember >
70- {
71- readonly List < SourceFileMember > properties ;
72-
73- public string Path { get ; }
74- public bool ForMany { get ; }
32+ sealed class SourceFileMember
33+ {
34+ public string Visibility { get ; }
35+ public string Type { get ; }
36+ public string Name { get ; }
37+ public string Arguments { get ; }
38+ public bool IsExpressionBody { get ; }
39+ public bool IsMethod { get ; }
40+
41+ public SourceFileMember ( string visibility , string type , string name , bool isExpressionBody )
42+ {
43+ if ( String . IsNullOrEmpty ( visibility ) )
44+ throw new ArgumentException ( nameof ( visibility ) ) ;
45+ if ( String . IsNullOrEmpty ( type ) )
46+ throw new ArgumentException ( nameof ( type ) ) ;
47+ if ( String . IsNullOrEmpty ( name ) )
48+ throw new ArgumentException ( nameof ( name ) ) ;
49+ Visibility = visibility ;
50+ Type = type ;
51+ Name = name ;
52+ IsExpressionBody = isExpressionBody ;
53+ IsMethod = false ;
54+ }
7555
76- public SourceFile ( string path , bool forMany = false )
77- {
78- if ( String . IsNullOrEmpty ( path ) )
79- throw new ArgumentException ( nameof ( path ) ) ;
80- Path = path ;
81- ForMany = forMany ;
82- properties = new List < SourceFileMember > ( ) ;
56+ public SourceFileMember ( string visibility , string type , string name , string arguments )
57+ {
58+ if ( String . IsNullOrEmpty ( visibility ) )
59+ throw new ArgumentException ( nameof ( visibility ) ) ;
60+ if ( String . IsNullOrEmpty ( type ) )
61+ throw new ArgumentException ( nameof ( type ) ) ;
62+ if ( String . IsNullOrEmpty ( name ) )
63+ throw new ArgumentException ( nameof ( name ) ) ;
64+ Visibility = visibility ;
65+ Type = type ;
66+ Name = name ;
67+ Arguments = arguments ?? String . Empty ;
68+ IsExpressionBody = false ;
69+ IsMethod = true ;
70+ }
8371 }
8472
85- public void Add ( string visibility , string type , string name , bool isExpressionBody = true )
73+ sealed class SourceFile : IEnumerable < SourceFileMember >
8674 {
87- properties . Add ( new SourceFileMember ( visibility , type , name , isExpressionBody ) ) ;
88- }
75+ readonly List < SourceFileMember > properties ;
8976
90- public void Add ( string visibility , string type , string name , string arguments )
91- {
92- properties . Add ( new SourceFileMember ( visibility , type , name , arguments ) ) ;
93- }
77+ public string Path { get ; }
78+ public bool ForMany { get ; }
9479
95- public IEnumerator < SourceFileMember > GetEnumerator ( )
96- {
97- return ( ( IEnumerable < SourceFileMember > ) properties ) . GetEnumerator ( ) ;
98- }
80+ public SourceFile ( string path , bool forMany = false )
81+ {
82+ if ( String . IsNullOrEmpty ( path ) )
83+ throw new ArgumentException ( nameof ( path ) ) ;
84+ Path = path ;
85+ ForMany = forMany ;
86+ properties = new List < SourceFileMember > ( ) ;
87+ }
9988
100- IEnumerator IEnumerable . GetEnumerator ( )
101- {
102- return ( ( IEnumerable < SourceFileMember > ) properties ) . GetEnumerator ( ) ;
103- }
104- }
89+ public void Add ( string visibility , string type , string name , bool isExpressionBody = true )
90+ {
91+ properties . Add ( new SourceFileMember ( visibility , type , name , isExpressionBody ) ) ;
92+ }
10593
106- sealed class TestProjectInfo
107- {
108- public string RootDirectory { get ; }
109- public string OutputDirectory { get ; }
110- public string ObjPath { get ; }
111- public string BinPath { get ; }
112- public string GeneratedPath { get ; }
113- public string SlnPath { get ; }
114- public string ProjectName { get ; }
115- public string TestName { get ; }
94+ public void Add ( string visibility , string type , string name , string arguments )
95+ {
96+ properties . Add ( new SourceFileMember ( visibility , type , name , arguments ) ) ;
97+ }
98+
99+ public IEnumerator < SourceFileMember > GetEnumerator ( )
100+ {
101+ return ( ( IEnumerable < SourceFileMember > ) properties ) . GetEnumerator ( ) ;
102+ }
116103
117- public TestProjectInfo ( string projectName , string testName , string rootDirectory , string outputRootDir )
104+ IEnumerator IEnumerable . GetEnumerator ( )
105+ {
106+ return ( ( IEnumerable < SourceFileMember > ) properties ) . GetEnumerator ( ) ;
107+ }
108+ }
109+
110+ sealed class TestProjectInfo
118111 {
119- TestName = testName ;
120- RootDirectory = rootDirectory ;
121- ProjectName = projectName ;
112+ public string RootDirectory { get ; }
113+ public string OutputDirectory { get ; }
114+ public string ObjPath { get ; }
115+ public string BinPath { get ; }
116+ public string GeneratedPath { get ; }
117+ public string SlnPath { get ; }
118+ public string ProjectName { get ; }
119+ public string TestName { get ; }
120+
121+ public TestProjectInfo ( string projectName , string testName , string rootDirectory , string outputRootDir )
122+ {
123+ TestName = testName ;
124+ RootDirectory = rootDirectory ;
125+ ProjectName = projectName ;
122126
123- ObjPath = Path . Combine ( rootDirectory , "obj" ) ;
124- GeneratedPath = Path . Combine ( ObjPath , XABuildPaths . Configuration , "generated" ) ;
125- BinPath = Path . Combine ( rootDirectory , "bin" , XABuildPaths . Configuration ) ;
126- SlnPath = Path . Combine ( rootDirectory , $ "{ projectName } .sln") ;
127+ ObjPath = Path . Combine ( rootDirectory , "obj" ) ;
128+ GeneratedPath = Path . Combine ( ObjPath , XABuildPaths . Configuration , "generated" ) ;
129+ BinPath = Path . Combine ( rootDirectory , "bin" , XABuildPaths . Configuration ) ;
130+ SlnPath = Path . Combine ( rootDirectory , $ "{ projectName } .sln") ;
127131
128- OutputDirectory = Path . Combine ( outputRootDir , testName , XABuildPaths . Configuration ) ;
132+ OutputDirectory = Path . Combine ( outputRootDir , testName , XABuildPaths . Configuration ) ;
133+ }
129134 }
130- }
131135
132- [ Parallelizable ( ParallelScope . Children ) ]
133- public class BuildTests_CodeBehindBuildTests
134- {
135136 const string ProjectName = "CodeBehindBuildTests" ;
136137 const string CommonSampleLibraryName = "CommonSampleLibrary" ;
137138
@@ -147,7 +148,7 @@ public class BuildTests_CodeBehindBuildTests
147148 "msbuild.binlog" ,
148149 } ;
149150
150- static BuildTests_CodeBehindBuildTests ( )
151+ static CodeBehindTests ( )
151152 {
152153 TestProjectRootDirectory = Path . GetFullPath ( Path . Combine ( XABuildPaths . TopDirectory , "tests" , "CodeBehind" , "BuildTests" ) ) ;
153154 CommonSampleLibraryRootDirectory = Path . GetFullPath ( Path . Combine ( XABuildPaths . TopDirectory , "tests" , "CodeBehind" , CommonSampleLibraryName ) ) ;
0 commit comments