@@ -3,76 +3,78 @@ using namespace Microsoft.PowerShell.Commands
33using namespace System.Collections.Generic
44using namespace System.Diagnostics.CodeAnalysis
55using namespace NuGet.Versioning
6+ using namespace ModuleFast
67
7- . $PSScriptRoot / ModuleFast.ps1 - ImportNuGetVersioning
8- Import-Module $PSScriptRoot / ModuleFast.psm1 - Force
8+ Import-Module $PSScriptRoot / ModuleFast.psd1 - Force
99
1010BeforeAll {
1111 if ($env: MFURI ) {
1212 $PSDefaultParameterValues [' *-ModuleFast*:Source' ] = $env: MFURI
1313 }
1414}
1515
16- InModuleScope ' ModuleFast' {
17- Describe ' ModuleFastSpec' {
18- Context ' Constructors' {
19- It ' Getters' {
20- $spec = [ModuleFastSpec ]' Test'
21- ' Name' , ' Guid' , ' Min' , ' Max' , ' Required' | ForEach-Object {
22- $spec.PSObject.Properties.name | Should - Contain $PSItem
23- }
16+ # ModuleFastSpec is a public C# class — no InModuleScope needed
17+ Describe ' ModuleFastSpec' {
18+ Context ' Constructors' {
19+ It ' Getters' {
20+ $spec = [ModuleFastSpec ]' Test'
21+ ' Name' , ' Guid' , ' Min' , ' Max' , ' Required' | ForEach-Object {
22+ $spec.PSObject.Properties.name | Should - Contain $PSItem
2423 }
24+ }
2525
26- It ' Name' {
27- $spec = [ModuleFastSpec ]' Test'
28- $spec.Name | Should - Be ' Test'
29- $spec.Guid | Should - Be ([Guid ]::Empty)
30- $spec.Min | Should - BeNull
31- $spec.Max | Should - BeNull
32- $spec.Required | Should - BeNull
33- }
26+ It ' Name' {
27+ $spec = [ModuleFastSpec ]' Test'
28+ $spec.Name | Should - Be ' Test'
29+ $spec.Guid | Should - Be ([Guid ]::Empty)
30+ $spec.Min | Should - BeNull
31+ $spec.Max | Should - BeNull
32+ $spec.Required | Should - BeNull
33+ }
3434
35- It ' Has non-settable properties' {
36- $spec = [ModuleFastSpec ]' Test'
37- { $spec.Min = ' 1' } | Should - Throw
38- { $spec.Max = ' 1' } | Should - Throw
39- { $spec.Required = ' 1' } | Should - Throw
40- { $spec.Name = ' fake' } | Should - Throw
41- { $spec.Guid = New-Guid } | Should - Throw
42- }
35+ It ' Has non-settable properties' {
36+ $spec = [ModuleFastSpec ]' Test'
37+ { $spec.Min = ' 1' } | Should - Throw
38+ { $spec.Max = ' 1' } | Should - Throw
39+ { $spec.Required = ' 1' } | Should - Throw
40+ { $spec.Name = ' fake' } | Should - Throw
41+ { $spec.Guid = New-Guid } | Should - Throw
42+ }
4343
44- It ' ModuleSpecification' {
45- $in = [ModuleSpecification ]@ {
46- ModuleName = ' Test'
47- ModuleVersion = ' 2.1.5'
48- }
49- $spec = [ModuleFastSpec ]$in
50- $spec.Name | Should - Be ' Test'
51- $spec.Guid | Should - Be ([Guid ]::Empty)
52- $spec.Min | Should - Be ' 2.1.5'
53- $spec.Max | Should - BeNull
54- $spec.Required | Should - BeNull
44+ It ' ModuleSpecification' {
45+ $in = [ModuleSpecification ]@ {
46+ ModuleName = ' Test'
47+ ModuleVersion = ' 2.1.5'
5548 }
49+ $spec = [ModuleFastSpec ]$in
50+ $spec.Name | Should - Be ' Test'
51+ $spec.Guid | Should - Be ([Guid ]::Empty)
52+ $spec.Min | Should - Be ' 2.1.5'
53+ $spec.Max | Should - BeNull
54+ $spec.Required | Should - BeNull
5655 }
56+ }
5757
58- Context ' ModuleSpecification Conversion' {
59- It ' Name' {
60- $spec = [ModuleSpecification ][ModuleFastSpec ]' Test'
61- $spec.Name | Should - Be ' Test'
62- $spec.Version | Should - Be ' 0.0'
63- $spec.RequiredVersion | Should - BeNull
64- $spec.MaximumVersion | Should - BeNull
65- }
66- It ' RequiredVersion' {
67- $spec = [ModuleSpecification ][ModuleFastSpec ]::new(' Test' , ' 1.2.3' )
68- $spec.Name | Should - Be ' Test'
69- $spec.RequiredVersion | Should - Be ' 1.2.3.0'
70- $spec.Version | Should - BeNull
71- $spec.MaximumVersion | Should - BeNull
72- }
58+ Context ' ModuleSpecification Conversion' {
59+ It ' Name' {
60+ $spec = [ModuleSpecification ][ModuleFastSpec ]' Test'
61+ $spec.Name | Should - Be ' Test'
62+ $spec.Version | Should - Be ' 0.0'
63+ $spec.RequiredVersion | Should - BeNull
64+ $spec.MaximumVersion | Should - BeNull
65+ }
66+ It ' RequiredVersion' {
67+ $spec = [ModuleSpecification ][ModuleFastSpec ]::new(' Test' , ' 1.2.3' )
68+ $spec.Name | Should - Be ' Test'
69+ $spec.RequiredVersion | Should - Be ' 1.2.3.0'
70+ $spec.Version | Should - BeNull
71+ $spec.MaximumVersion | Should - BeNull
7372 }
7473 }
74+ }
7575
76+ # Import-ModuleManifest is a private PS function — InModuleScope required
77+ InModuleScope ' ModuleFast' {
7678 Describe ' Import-ModuleManifest' {
7779 It ' Reads Dynamic Manifest' {
7880 $Mocks = " $PSScriptRoot /Test/Mocks"
0 commit comments