-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from MartinKuschnik/20-arrays-of-iunknown-not-…
…working Added support for Arrays of IUnknown
- Loading branch information
Showing
18 changed files
with
4,125 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,256 @@ | ||
using System.Management; | ||
|
||
namespace WmiLight.UnitTests | ||
{ | ||
[TestClass] | ||
public class Msvm_VirtualSystemCapabilities | ||
{ | ||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_Caption_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.String>(msObject, wmiObject, "Caption"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_Caption_Is_String() | ||
{ | ||
const string PropertyName = "Caption"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.String>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.String>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.String genericValue = wmiObject.GetPropertyValue<System.String>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_Description_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.String>(msObject, wmiObject, "Description"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_Description_Is_String() | ||
{ | ||
const string PropertyName = "Description"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.String>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.String>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.String genericValue = wmiObject.GetPropertyValue<System.String>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_ElementName_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.String>(msObject, wmiObject, "ElementName"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_ElementName_Is_String() | ||
{ | ||
const string PropertyName = "ElementName"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.String>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.String>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.String genericValue = wmiObject.GetPropertyValue<System.String>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_ElementNameEditSupported_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.Boolean>(msObject, wmiObject, "ElementNameEditSupported"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_ElementNameEditSupported_Is_Boolean() | ||
{ | ||
const string PropertyName = "ElementNameEditSupported"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.Boolean>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.Boolean>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.Boolean genericValue = wmiObject.GetPropertyValue<System.Boolean>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_ElementNameMask_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.String>(msObject, wmiObject, "ElementNameMask"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_ElementNameMask_Is_String() | ||
{ | ||
const string PropertyName = "ElementNameMask"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.String>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.String>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.String genericValue = wmiObject.GetPropertyValue<System.String>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_InstanceID_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.String>(msObject, wmiObject, "InstanceID"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_InstanceID_Is_String() | ||
{ | ||
const string PropertyName = "InstanceID"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.String>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.String>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.String genericValue = wmiObject.GetPropertyValue<System.String>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_MaxElementNameLen_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.UInt16>(msObject, wmiObject, "MaxElementNameLen"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_MaxElementNameLen_Is_UInt16() | ||
{ | ||
const string PropertyName = "MaxElementNameLen"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.UInt16>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.UInt16>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.UInt16 genericValue = wmiObject.GetPropertyValue<System.UInt16>(PropertyName); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_RequestedStatesSupported_Is_Equal_To_System_Management() | ||
{ | ||
using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
WmiAssert.AreEqual<System.UInt16[]>(msObject, wmiObject, "RequestedStatesSupported"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void Msvm_VirtualSystemCapabilities_RequestedStatesSupported_Is_UInt16Array() | ||
{ | ||
const string PropertyName = "RequestedStatesSupported"; | ||
|
||
using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_VirtualSystemCapabilities")) | ||
{ | ||
object indexerValue = wmiObject[PropertyName]; | ||
|
||
if (indexerValue != null) | ||
Assert.IsInstanceOfType<System.UInt16[]>(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); | ||
|
||
object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); | ||
|
||
if (noneGenericValue != null) | ||
Assert.IsInstanceOfType<System.UInt16[]>(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); | ||
|
||
System.UInt16[] genericValue = wmiObject.GetPropertyValue<System.UInt16[]>(PropertyName); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.