2
2
// Licensed under the MIT License.
3
3
4
4
using System ;
5
- using System . IO ;
6
5
using System . Linq ;
7
6
using System . Management . Automation ;
8
7
using Newtonsoft . Json ;
9
8
using Newtonsoft . Json . Linq ;
10
- using PSRule . Configuration ;
11
9
using PSRule . Definitions ;
12
10
using PSRule . Definitions . Baselines ;
13
11
using PSRule . Host ;
18
16
19
17
namespace PSRule ;
20
18
21
- public sealed class BaselineTests
19
+ public sealed class BaselineTests : BaseTests
22
20
{
23
21
private const string BaselineYamlFileName = "Baseline.Rule.yaml" ;
24
22
private const string BaselineJsonFileName = "Baseline.Rule.jsonc" ;
@@ -175,7 +173,7 @@ public void BaselineAsJson()
175
173
176
174
#region Helper methods
177
175
178
- private static Baseline [ ] GetBaselines ( Source [ ] source )
176
+ private Baseline [ ] GetBaselines ( Source [ ] source )
179
177
{
180
178
var context = new RunspaceContext ( PipelineContext . New ( GetOption ( ) , null , null , new TestWriter ( GetOption ( ) ) , new OptionContextBuilder ( ) , null ) ) ;
181
179
context . Init ( source ) ;
@@ -184,18 +182,6 @@ private static Baseline[] GetBaselines(Source[] source)
184
182
return baseline ;
185
183
}
186
184
187
- private static PSRuleOption GetOption ( )
188
- {
189
- return new PSRuleOption ( ) ;
190
- }
191
-
192
- private static Source [ ] GetSource ( string path )
193
- {
194
- var builder = new SourcePipelineBuilder ( null , null ) ;
195
- builder . Directory ( GetSourcePath ( path ) ) ;
196
- return builder . Build ( ) ;
197
- }
198
-
199
185
private static Source [ ] GetSourceInModule ( string path , string moduleName , SourceType type )
200
186
{
201
187
var file = new SourceFile ( GetSourcePath ( path ) , moduleName , type , null ) ;
@@ -207,10 +193,5 @@ private static Source[] GetSourceInModule(string path, string moduleName, Source
207
193
return [ source ] ;
208
194
}
209
195
210
- private static string GetSourcePath ( string fileName )
211
- {
212
- return Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , fileName ) ;
213
- }
214
-
215
196
#endregion Helper methods
216
197
}
0 commit comments