File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed
Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 33// terms of the MIT license.
44
55using System ;
6+ using System . Management ;
67
78namespace AnyPackage . Provider . Msu
89{
910 [ PackageProvider ( "Msu" ) ]
10- public sealed class MsuProvider : PackageProvider
11+ public sealed class MsuProvider : PackageProvider , IGetPackage
1112 {
1213 private readonly static Guid s_id = new Guid ( "314633fe-c7e9-4eeb-824b-382a8a4e92b8" ) ;
1314
1415 public MsuProvider ( ) : base ( s_id ) { }
16+
17+ public void GetPackage ( PackageRequest request )
18+ {
19+ var quickFix = new ManagementObjectSearcher ( @"root\cimv2" , "select * from Win32_QuickFixEngineering" ) ;
20+
21+ foreach ( var hotFix in quickFix . Get ( ) )
22+ {
23+ if ( request . IsMatch ( ( string ) hotFix [ "HotFixID" ] ) )
24+ {
25+ request . WritePackage ( ( string ) hotFix [ "HotFixID" ] ,
26+ new PackageVersion ( "0" ) ,
27+ ( string ) hotFix [ "Description" ] ) ;
28+ }
29+ }
30+ }
1531 }
1632}
Original file line number Diff line number Diff line change 1010 <ItemGroup >
1111 <PackageReference Include =" AnyPackage" Version =" 0.4.2" />
1212 <PackageReference Include =" PowerShellStandard.Library" Version =" 5.1.1" />
13+ <PackageReference Include =" System.Management" Version =" 7.0.0" />
1314 </ItemGroup >
1415
1516</Project >
Original file line number Diff line number Diff line change 22
33Describe Get-Package {
44 Context ' with no parameters' {
5- It ' should return results' - Skip {
5+ It ' should return results' {
66 Get-Package |
77 Should -Not - BeNullOrEmpty
88 }
99 }
10-
11- Context ' with -Name parameter' {
12- It ' should return <_> package' - ForEach ' ' - Skip {
13- Get-Package - Name $_ |
14- Should -Not - BeNullOrEmpty
15- }
16- }
1710}
You can’t perform that action at this time.
0 commit comments