diff --git a/WmiLight.Native/WmiLight.Native.rc b/WmiLight.Native/WmiLight.Native.rc index 7b11c0b..6a40b0d 100644 --- a/WmiLight.Native/WmiLight.Native.rc +++ b/WmiLight.Native/WmiLight.Native.rc @@ -43,8 +43,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 6,1,1,0 - PRODUCTVERSION 6,1,1,0 + FILEVERSION 6,2,0,0 + PRODUCTVERSION 6,2,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -61,12 +61,12 @@ BEGIN BEGIN VALUE "CompanyName", "Martin Kuschnik" VALUE "FileDescription", "The native part of the WmiLight lib." - VALUE "FileVersion", "6.1.1.0" + VALUE "FileVersion", "6.2.0.0" VALUE "InternalName", "WmiLight.Native" VALUE "LegalCopyright", "Copyright 2024 Martin Kuschnik" VALUE "OriginalFilename", "WmiLight.Native.dll" VALUE "ProductName", "WmiLight" - VALUE "ProductVersion", "6.1.1.0" + VALUE "ProductVersion", "6.2.0.0" END END BLOCK "VarFileInfo" diff --git a/WmiLight.UnitTests/MSFT_Volume.cs b/WmiLight.UnitTests/MSFT_Volume.cs new file mode 100644 index 0000000..60d8a13 --- /dev/null +++ b/WmiLight.UnitTests/MSFT_Volume.cs @@ -0,0 +1,442 @@ +using System.Management; + +namespace WmiLight.UnitTests +{ + [TestClass] + public class MSFT_Volume + { + [TestMethod] + public void MSFT_Volume_AllocationUnitSize_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "AllocationUnitSize"); + } + } + + [TestMethod] + public void MSFT_Volume_AllocationUnitSize_Is_UInt32() + { + const string PropertyName = "AllocationUnitSize"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_DedupMode_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DedupMode"); + } + } + + [TestMethod] + public void MSFT_Volume_DedupMode_Is_UInt32() + { + const string PropertyName = "DedupMode"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_DriveType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DriveType"); + } + } + + [TestMethod] + public void MSFT_Volume_DriveType_Is_UInt32() + { + const string PropertyName = "DriveType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_FileSystem_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "FileSystem"); + } + } + + [TestMethod] + public void MSFT_Volume_FileSystem_Is_String() + { + const string PropertyName = "FileSystem"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_FileSystemLabel_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "FileSystemLabel"); + } + } + + [TestMethod] + public void MSFT_Volume_FileSystemLabel_Is_String() + { + const string PropertyName = "FileSystemLabel"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_FileSystemType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "FileSystemType"); + } + } + + [TestMethod] + public void MSFT_Volume_FileSystemType_Is_UInt16() + { + const string PropertyName = "FileSystemType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_HealthStatus_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "HealthStatus"); + } + } + + [TestMethod] + public void MSFT_Volume_HealthStatus_Is_UInt16() + { + const string PropertyName = "HealthStatus"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_ObjectId_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ObjectId"); + } + } + + [TestMethod] + public void MSFT_Volume_ObjectId_Is_String() + { + const string PropertyName = "ObjectId"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_OperationalStatus_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "OperationalStatus"); + } + } + + [TestMethod] + public void MSFT_Volume_OperationalStatus_Is_UInt16Array() + { + const string PropertyName = "OperationalStatus"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_Path_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Path"); + } + } + + [TestMethod] + public void MSFT_Volume_Path_Is_String() + { + const string PropertyName = "Path"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_Size_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Size"); + } + } + + [TestMethod] + public void MSFT_Volume_Size_Is_UInt64() + { + const string PropertyName = "Size"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_SizeRemaining_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "SizeRemaining"); + } + } + + [TestMethod] + public void MSFT_Volume_SizeRemaining_Is_UInt64() + { + const string PropertyName = "SizeRemaining"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_UniqueId_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "UniqueId"); + } + } + + [TestMethod] + public void MSFT_Volume_UniqueId_Is_String() + { + const string PropertyName = "UniqueId"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void MSFT_Volume_DriveLetter_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DriveLetter"); + } + } + + [TestMethod] + public void MSFT_Volume_DriveLetter_Is_Char() + { + const string PropertyName = "DriveLetter"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\Microsoft\Windows\Storage", "MSFT_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Char genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + } +} \ No newline at end of file diff --git a/WmiLight.UnitTests/Msvm_ComputerSystem.cs b/WmiLight.UnitTests/Msvm_ComputerSystem.cs new file mode 100644 index 0000000..1eb9c0e --- /dev/null +++ b/WmiLight.UnitTests/Msvm_ComputerSystem.cs @@ -0,0 +1,814 @@ +using System.Management; + +namespace WmiLight.UnitTests +{ + [TestClass] + public class Msvm_ComputerSystem + { + [TestMethod] + public void Msvm_ComputerSystem_Caption_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Caption"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Caption_Is_String() + { + const string PropertyName = "Caption"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_CreationClassName_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CreationClassName"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_CreationClassName_Is_String() + { + const string PropertyName = "CreationClassName"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Description_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Description"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Description_Is_String() + { + const string PropertyName = "Description"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ElementName_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ElementName"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ElementName_Is_String() + { + const string PropertyName = "ElementName"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_EnabledDefault_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "EnabledDefault"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_EnabledDefault_Is_UInt16() + { + const string PropertyName = "EnabledDefault"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_EnabledState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "EnabledState"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_EnabledState_Is_UInt16() + { + const string PropertyName = "EnabledState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_HealthState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "HealthState"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_HealthState_Is_UInt16() + { + const string PropertyName = "HealthState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Name_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Name"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Name_Is_String() + { + const string PropertyName = "Name"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_NumberOfNumaNodes_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "NumberOfNumaNodes"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_NumberOfNumaNodes_Is_UInt16() + { + const string PropertyName = "NumberOfNumaNodes"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_OperationalStatus_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "OperationalStatus"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_OperationalStatus_Is_UInt16Array() + { + const string PropertyName = "OperationalStatus"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_RequestedState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "RequestedState"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_RequestedState_Is_UInt16() + { + const string PropertyName = "RequestedState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ResetCapability_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ResetCapability"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ResetCapability_Is_UInt16() + { + const string PropertyName = "ResetCapability"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Status_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Status"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_Status_Is_String() + { + const string PropertyName = "Status"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_StatusDescriptions_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "StatusDescriptions"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_StatusDescriptions_Is_StringArray() + { + const string PropertyName = "StatusDescriptions"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_EnhancedSessionModeState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "EnhancedSessionModeState"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_EnhancedSessionModeState_Is_UInt16() + { + const string PropertyName = "EnhancedSessionModeState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_FailedOverReplicationType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "FailedOverReplicationType"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_FailedOverReplicationType_Is_UInt16() + { + const string PropertyName = "FailedOverReplicationType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_LastApplicationConsistentReplicationTime_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "LastApplicationConsistentReplicationTime"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_LastApplicationConsistentReplicationTime_Is_String() + { + const string PropertyName = "LastApplicationConsistentReplicationTime"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_LastReplicationTime_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "LastReplicationTime"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_LastReplicationTime_Is_String() + { + const string PropertyName = "LastReplicationTime"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_LastReplicationType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "LastReplicationType"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_LastReplicationType_Is_UInt16() + { + const string PropertyName = "LastReplicationType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_OnTimeInMilliseconds_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "OnTimeInMilliseconds"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_OnTimeInMilliseconds_Is_UInt64() + { + const string PropertyName = "OnTimeInMilliseconds"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ReplicationHealth_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationHealth"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ReplicationHealth_Is_UInt16() + { + const string PropertyName = "ReplicationHealth"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ReplicationMode_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationMode"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ReplicationMode_Is_UInt16() + { + const string PropertyName = "ReplicationMode"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ReplicationState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationState"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_ReplicationState_Is_UInt16() + { + const string PropertyName = "ReplicationState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_TimeOfLastConfigurationChange_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "TimeOfLastConfigurationChange"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_TimeOfLastConfigurationChange_Is_String() + { + const string PropertyName = "TimeOfLastConfigurationChange"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_TimeOfLastStateChange_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "TimeOfLastStateChange"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_TimeOfLastStateChange_Is_String() + { + const string PropertyName = "TimeOfLastStateChange"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_InstallDate_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "InstallDate"); + } + } + + [TestMethod] + public void Msvm_ComputerSystem_InstallDate_Is_String() + { + const string PropertyName = "InstallDate"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_ComputerSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + } +} \ No newline at end of file diff --git a/WmiLight.UnitTests/Msvm_SummaryInformation.cs b/WmiLight.UnitTests/Msvm_SummaryInformation.cs new file mode 100644 index 0000000..37cd7ff --- /dev/null +++ b/WmiLight.UnitTests/Msvm_SummaryInformation.cs @@ -0,0 +1,845 @@ +using System.Management; + +namespace WmiLight.UnitTests +{ + [TestClass] + public class Msvm_SummaryInformation + { + [TestMethod] + public void Msvm_SummaryInformation_AvailableMemoryBuffer_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "AvailableMemoryBuffer"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_AvailableMemoryBuffer_Is_Int32() + { + const string PropertyName = "AvailableMemoryBuffer"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Int32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ElementName_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ElementName"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ElementName_Is_String() + { + const string PropertyName = "ElementName"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_EnabledState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "EnabledState"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_EnabledState_Is_UInt16() + { + const string PropertyName = "EnabledState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_EnhancedSessionModeState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "EnhancedSessionModeState"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_EnhancedSessionModeState_Is_UInt16() + { + const string PropertyName = "EnhancedSessionModeState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_HealthState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "HealthState"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_HealthState_Is_UInt16() + { + const string PropertyName = "HealthState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_HostComputerSystemName_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "HostComputerSystemName"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_HostComputerSystemName_Is_String() + { + const string PropertyName = "HostComputerSystemName"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_InstanceID_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "InstanceID"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_InstanceID_Is_String() + { + const string PropertyName = "InstanceID"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_MemoryAvailable_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MemoryAvailable"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_MemoryAvailable_Is_Int32() + { + const string PropertyName = "MemoryAvailable"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Int32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Name_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Name"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Name_Is_String() + { + const string PropertyName = "Name"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_OperationalStatus_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "OperationalStatus"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_OperationalStatus_Is_UInt16Array() + { + const string PropertyName = "OperationalStatus"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationHealth_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationHealth"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationHealth_Is_UInt16() + { + const string PropertyName = "ReplicationHealth"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationHealthEx_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationHealthEx"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationHealthEx_Is_UInt16Array() + { + const string PropertyName = "ReplicationHealthEx"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationMode_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationMode"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationMode_Is_UInt16() + { + const string PropertyName = "ReplicationMode"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationProviderId_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationProviderId"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationProviderId_Is_StringArray() + { + const string PropertyName = "ReplicationProviderId"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationState_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationState"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationState_Is_UInt16() + { + const string PropertyName = "ReplicationState"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationStateEx_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ReplicationStateEx"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_ReplicationStateEx_Is_UInt16Array() + { + const string PropertyName = "ReplicationStateEx"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_StatusDescriptions_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "StatusDescriptions"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_StatusDescriptions_Is_StringArray() + { + const string PropertyName = "StatusDescriptions"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_SwapFilesInUse_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "SwapFilesInUse"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_SwapFilesInUse_Is_Boolean() + { + const string PropertyName = "SwapFilesInUse"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_UpTime_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "UpTime"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_UpTime_Is_UInt64() + { + const string PropertyName = "UpTime"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_VirtualSystemSubType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "VirtualSystemSubType"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_VirtualSystemSubType_Is_String() + { + const string PropertyName = "VirtualSystemSubType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_CreationTime_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CreationTime"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_CreationTime_Is_String() + { + const string PropertyName = "CreationTime"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Notes_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Notes"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Notes_Is_String() + { + const string PropertyName = "Notes"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_NumberOfProcessors_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "NumberOfProcessors"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_NumberOfProcessors_Is_UInt16() + { + const string PropertyName = "NumberOfProcessors"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Shielded_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Shielded"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Shielded_Is_Boolean() + { + const string PropertyName = "Shielded"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Snapshots_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Snapshots"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Snapshots_Is_ManagementBaseObjectArray() + { + const string PropertyName = "Snapshots"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Management.ManagementBaseObject[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Version_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Version"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_Version_Is_String() + { + const string PropertyName = "Version"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_VirtualSwitchNames_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + WmiAssert.AreEqual(msObject, wmiObject, "VirtualSwitchNames"); + } + } + + [TestMethod] + public void Msvm_SummaryInformation_VirtualSwitchNames_Is_StringArray() + { + const string PropertyName = "VirtualSwitchNames"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\virtualization\v2", "Msvm_SummaryInformation")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + } +} \ No newline at end of file diff --git a/WmiLight.UnitTests/Msvm_VirtualSystemCapabilities.cs b/WmiLight.UnitTests/Msvm_VirtualSystemCapabilities.cs new file mode 100644 index 0000000..9afd6e7 --- /dev/null +++ b/WmiLight.UnitTests/Msvm_VirtualSystemCapabilities.cs @@ -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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(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(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(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + } +} \ No newline at end of file diff --git a/WmiLight.UnitTests/Win32_Desktop.cs b/WmiLight.UnitTests/Win32_Desktop.cs index 554cde6..fe09d01 100644 --- a/WmiLight.UnitTests/Win32_Desktop.cs +++ b/WmiLight.UnitTests/Win32_Desktop.cs @@ -314,5 +314,98 @@ public void Win32_Desktop_WallpaperStretched_Is_Boolean() System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); } } + + [TestMethod] + public void Win32_Desktop_Wallpaper_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Desktop")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Desktop")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Wallpaper"); + } + } + + [TestMethod] + public void Win32_Desktop_Wallpaper_Is_String() + { + const string PropertyName = "Wallpaper"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Desktop")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Desktop_WallpaperTiled_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Desktop")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Desktop")) + { + WmiAssert.AreEqual(msObject, wmiObject, "WallpaperTiled"); + } + } + + [TestMethod] + public void Win32_Desktop_WallpaperTiled_Is_Boolean() + { + const string PropertyName = "WallpaperTiled"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Desktop")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Desktop_IconSpacing_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Desktop")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Desktop")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IconSpacing"); + } + } + + [TestMethod] + public void Win32_Desktop_IconSpacing_Is_UInt32() + { + const string PropertyName = "IconSpacing"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Desktop")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } } } \ No newline at end of file diff --git a/WmiLight.UnitTests/Win32_NetworkAdapter.cs b/WmiLight.UnitTests/Win32_NetworkAdapter.cs index 4ea11a7..64fadfb 100644 --- a/WmiLight.UnitTests/Win32_NetworkAdapter.cs +++ b/WmiLight.UnitTests/Win32_NetworkAdapter.cs @@ -655,5 +655,253 @@ public void Win32_NetworkAdapter_TimeOfLastReset_Is_String() System.String genericValue = wmiObject.GetPropertyValue(PropertyName); } } + + [TestMethod] + public void Win32_NetworkAdapter_AdapterType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "AdapterType"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_AdapterType_Is_String() + { + const string PropertyName = "AdapterType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_AdapterTypeId_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "AdapterTypeId"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_AdapterTypeId_Is_UInt16() + { + const string PropertyName = "AdapterTypeId"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_GUID_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "GUID"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_GUID_Is_String() + { + const string PropertyName = "GUID"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_MACAddress_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MACAddress"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_MACAddress_Is_String() + { + const string PropertyName = "MACAddress"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_NetConnectionID_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "NetConnectionID"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_NetConnectionID_Is_String() + { + const string PropertyName = "NetConnectionID"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_NetConnectionStatus_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "NetConnectionStatus"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_NetConnectionStatus_Is_UInt16() + { + const string PropertyName = "NetConnectionStatus"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_NetEnabled_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "NetEnabled"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_NetEnabled_Is_Boolean() + { + const string PropertyName = "NetEnabled"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_Speed_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapter")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + WmiAssert.AreEqual(msObject, wmiObject, "Speed"); + } + } + + [TestMethod] + public void Win32_NetworkAdapter_Speed_Is_UInt64() + { + const string PropertyName = "Speed"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapter")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } } } \ No newline at end of file diff --git a/WmiLight.UnitTests/Win32_NetworkAdapterConfiguration.cs b/WmiLight.UnitTests/Win32_NetworkAdapterConfiguration.cs index 152217a..5ea19ae 100644 --- a/WmiLight.UnitTests/Win32_NetworkAdapterConfiguration.cs +++ b/WmiLight.UnitTests/Win32_NetworkAdapterConfiguration.cs @@ -252,5 +252,718 @@ public void Win32_NetworkAdapterConfiguration_SettingID_Is_String() System.String genericValue = wmiObject.GetPropertyValue(PropertyName); } } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DatabasePath_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DatabasePath"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DatabasePath_Is_String() + { + const string PropertyName = "DatabasePath"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DefaultIPGateway_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DefaultIPGateway"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DefaultIPGateway_Is_StringArray() + { + const string PropertyName = "DefaultIPGateway"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DHCPLeaseExpires_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DHCPLeaseExpires"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DHCPLeaseExpires_Is_String() + { + const string PropertyName = "DHCPLeaseExpires"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DHCPLeaseObtained_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DHCPLeaseObtained"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DHCPLeaseObtained_Is_String() + { + const string PropertyName = "DHCPLeaseObtained"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DHCPServer_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DHCPServer"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DHCPServer_Is_String() + { + const string PropertyName = "DHCPServer"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSDomainSuffixSearchOrder_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DNSDomainSuffixSearchOrder"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSDomainSuffixSearchOrder_Is_StringArray() + { + const string PropertyName = "DNSDomainSuffixSearchOrder"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSEnabledForWINSResolution_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DNSEnabledForWINSResolution"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSEnabledForWINSResolution_Is_Boolean() + { + const string PropertyName = "DNSEnabledForWINSResolution"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSHostName_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DNSHostName"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSHostName_Is_String() + { + const string PropertyName = "DNSHostName"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSServerSearchOrder_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DNSServerSearchOrder"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DNSServerSearchOrder_Is_StringArray() + { + const string PropertyName = "DNSServerSearchOrder"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DomainDNSRegistrationEnabled_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DomainDNSRegistrationEnabled"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_DomainDNSRegistrationEnabled_Is_Boolean() + { + const string PropertyName = "DomainDNSRegistrationEnabled"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_FullDNSRegistrationEnabled_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "FullDNSRegistrationEnabled"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_FullDNSRegistrationEnabled_Is_Boolean() + { + const string PropertyName = "FullDNSRegistrationEnabled"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_GatewayCostMetric_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "GatewayCostMetric"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_GatewayCostMetric_Is_UInt16Array() + { + const string PropertyName = "GatewayCostMetric"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPAddress_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPAddress"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPAddress_Is_StringArray() + { + const string PropertyName = "IPAddress"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPConnectionMetric_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPConnectionMetric"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPConnectionMetric_Is_UInt32() + { + const string PropertyName = "IPConnectionMetric"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPFilterSecurityEnabled_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPFilterSecurityEnabled"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPFilterSecurityEnabled_Is_Boolean() + { + const string PropertyName = "IPFilterSecurityEnabled"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSecPermitIPProtocols_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPSecPermitIPProtocols"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSecPermitIPProtocols_Is_StringArray() + { + const string PropertyName = "IPSecPermitIPProtocols"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSecPermitTCPPorts_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPSecPermitTCPPorts"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSecPermitTCPPorts_Is_StringArray() + { + const string PropertyName = "IPSecPermitTCPPorts"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSecPermitUDPPorts_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPSecPermitUDPPorts"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSecPermitUDPPorts_Is_StringArray() + { + const string PropertyName = "IPSecPermitUDPPorts"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSubnet_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "IPSubnet"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_IPSubnet_Is_StringArray() + { + const string PropertyName = "IPSubnet"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String[] genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_MACAddress_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MACAddress"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_MACAddress_Is_String() + { + const string PropertyName = "MACAddress"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_TcpipNetbiosOptions_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "TcpipNetbiosOptions"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_TcpipNetbiosOptions_Is_UInt32() + { + const string PropertyName = "TcpipNetbiosOptions"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_WINSEnableLMHostsLookup_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "WINSEnableLMHostsLookup"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_WINSEnableLMHostsLookup_Is_Boolean() + { + const string PropertyName = "WINSEnableLMHostsLookup"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_WINSScopeID_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + WmiAssert.AreEqual(msObject, wmiObject, "WINSScopeID"); + } + } + + [TestMethod] + public void Win32_NetworkAdapterConfiguration_WINSScopeID_Is_String() + { + const string PropertyName = "WINSScopeID"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_NetworkAdapterConfiguration")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } } } \ No newline at end of file diff --git a/WmiLight.UnitTests/Win32_OperatingSystem.cs b/WmiLight.UnitTests/Win32_OperatingSystem.cs index 2b2f788..0d29c5b 100644 --- a/WmiLight.UnitTests/Win32_OperatingSystem.cs +++ b/WmiLight.UnitTests/Win32_OperatingSystem.cs @@ -594,69 +594,6 @@ public void Win32_OperatingSystem_ForegroundApplicationBoost_Is_Byte() } } - [TestMethod] - public void Win32_OperatingSystem_FreePhysicalMemory_Is_UInt64() - { - const string PropertyName = "FreePhysicalMemory"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_OperatingSystem")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - - [TestMethod] - public void Win32_OperatingSystem_FreeSpaceInPagingFiles_Is_UInt64() - { - const string PropertyName = "FreeSpaceInPagingFiles"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_OperatingSystem")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - - [TestMethod] - public void Win32_OperatingSystem_FreeVirtualMemory_Is_UInt64() - { - const string PropertyName = "FreeVirtualMemory"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_OperatingSystem")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - [TestMethod] public void Win32_OperatingSystem_InstallDate_Is_Equal_To_System_Management() { @@ -719,27 +656,6 @@ public void Win32_OperatingSystem_LastBootUpTime_Is_String() } } - [TestMethod] - public void Win32_OperatingSystem_LocalDateTime_Is_String() - { - const string PropertyName = "LocalDateTime"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_OperatingSystem")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.String genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - [TestMethod] public void Win32_OperatingSystem_Locale_Is_Equal_To_System_Management() { @@ -926,6 +842,37 @@ public void Win32_OperatingSystem_Name_Is_String() } } + [TestMethod] + public void Win32_OperatingSystem_NumberOfLicensedUsers_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_OperatingSystem")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_OperatingSystem")) + { + WmiAssert.AreEqual(msObject, wmiObject, "NumberOfLicensedUsers"); + } + } + + [TestMethod] + public void Win32_OperatingSystem_NumberOfLicensedUsers_Is_UInt32() + { + const string PropertyName = "NumberOfLicensedUsers"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_OperatingSystem")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + [TestMethod] public void Win32_OperatingSystem_NumberOfProcesses_Is_Equal_To_System_Management() { diff --git a/WmiLight.UnitTests/Win32_Process.cs b/WmiLight.UnitTests/Win32_Process.cs index da750f1..f9586e8 100644 --- a/WmiLight.UnitTests/Win32_Process.cs +++ b/WmiLight.UnitTests/Win32_Process.cs @@ -253,27 +253,6 @@ public void Win32_Process_HandleCount_Is_UInt32() } } - [TestMethod] - public void Win32_Process_KernelModeTime_Is_UInt64() - { - const string PropertyName = "KernelModeTime"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - [TestMethod] public void Win32_Process_Name_Is_Equal_To_System_Management() { @@ -1141,5 +1120,129 @@ public void Win32_Process_WriteTransferCount_Is_UInt64() System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); } } + + [TestMethod] + public void Win32_Process_MaximumWorkingSetSize_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Process")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MaximumWorkingSetSize"); + } + } + + [TestMethod] + public void Win32_Process_MaximumWorkingSetSize_Is_UInt32() + { + const string PropertyName = "MaximumWorkingSetSize"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Process_MinimumWorkingSetSize_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Process")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MinimumWorkingSetSize"); + } + } + + [TestMethod] + public void Win32_Process_MinimumWorkingSetSize_Is_UInt32() + { + const string PropertyName = "MinimumWorkingSetSize"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Process_CommandLine_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Process")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CommandLine"); + } + } + + [TestMethod] + public void Win32_Process_CommandLine_Is_String() + { + const string PropertyName = "CommandLine"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Process_ExecutablePath_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Process")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + WmiAssert.AreEqual(msObject, wmiObject, "ExecutablePath"); + } + } + + [TestMethod] + public void Win32_Process_ExecutablePath_Is_String() + { + const string PropertyName = "ExecutablePath"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Process")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } } } \ No newline at end of file diff --git a/WmiLight.UnitTests/Win32_Processor.cs b/WmiLight.UnitTests/Win32_Processor.cs index 1cac201..1ee41c5 100644 --- a/WmiLight.UnitTests/Win32_Processor.cs +++ b/WmiLight.UnitTests/Win32_Processor.cs @@ -501,37 +501,6 @@ public void Win32_Processor_L2CacheSize_Is_UInt32() } } - [TestMethod] - public void Win32_Processor_L3CacheSize_Is_Equal_To_System_Management() - { - using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Processor")) - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Processor")) - { - WmiAssert.AreEqual(msObject, wmiObject, "L3CacheSize"); - } - } - - [TestMethod] - public void Win32_Processor_L3CacheSize_Is_UInt32() - { - const string PropertyName = "L3CacheSize"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Processor")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - [TestMethod] public void Win32_Processor_L3CacheSpeed_Is_Equal_To_System_Management() { @@ -594,27 +563,6 @@ public void Win32_Processor_Level_Is_UInt16() } } - [TestMethod] - public void Win32_Processor_LoadPercentage_Is_UInt16() - { - const string PropertyName = "LoadPercentage"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Processor")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - [TestMethod] public void Win32_Processor_Manufacturer_Is_Equal_To_System_Management() { diff --git a/WmiLight.UnitTests/Win32_VideoController.cs b/WmiLight.UnitTests/Win32_VideoController.cs index 1ac429d..190cd57 100644 --- a/WmiLight.UnitTests/Win32_VideoController.cs +++ b/WmiLight.UnitTests/Win32_VideoController.cs @@ -748,5 +748,377 @@ public void Win32_VideoController_VideoProcessor_Is_String() System.String genericValue = wmiObject.GetPropertyValue(PropertyName); } } + + [TestMethod] + public void Win32_VideoController_CurrentBitsPerPixel_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentBitsPerPixel"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentBitsPerPixel_Is_UInt32() + { + const string PropertyName = "CurrentBitsPerPixel"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentHorizontalResolution_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentHorizontalResolution"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentHorizontalResolution_Is_UInt32() + { + const string PropertyName = "CurrentHorizontalResolution"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentNumberOfColors_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentNumberOfColors"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentNumberOfColors_Is_UInt64() + { + const string PropertyName = "CurrentNumberOfColors"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentNumberOfColumns_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentNumberOfColumns"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentNumberOfColumns_Is_UInt32() + { + const string PropertyName = "CurrentNumberOfColumns"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentNumberOfRows_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentNumberOfRows"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentNumberOfRows_Is_UInt32() + { + const string PropertyName = "CurrentNumberOfRows"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentRefreshRate_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentRefreshRate"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentRefreshRate_Is_UInt32() + { + const string PropertyName = "CurrentRefreshRate"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentScanMode_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentScanMode"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentScanMode_Is_UInt16() + { + const string PropertyName = "CurrentScanMode"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt16 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentVerticalResolution_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "CurrentVerticalResolution"); + } + } + + [TestMethod] + public void Win32_VideoController_CurrentVerticalResolution_Is_UInt32() + { + const string PropertyName = "CurrentVerticalResolution"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_DitherType_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DitherType"); + } + } + + [TestMethod] + public void Win32_VideoController_DitherType_Is_UInt32() + { + const string PropertyName = "DitherType"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_MaxRefreshRate_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MaxRefreshRate"); + } + } + + [TestMethod] + public void Win32_VideoController_MaxRefreshRate_Is_UInt32() + { + const string PropertyName = "MaxRefreshRate"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_MinRefreshRate_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "MinRefreshRate"); + } + } + + [TestMethod] + public void Win32_VideoController_MinRefreshRate_Is_UInt32() + { + const string PropertyName = "MinRefreshRate"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.UInt32 genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_VideoController_VideoModeDescription_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_VideoController")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + WmiAssert.AreEqual(msObject, wmiObject, "VideoModeDescription"); + } + } + + [TestMethod] + public void Win32_VideoController_VideoModeDescription_Is_String() + { + const string PropertyName = "VideoModeDescription"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_VideoController")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.String genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } } } \ No newline at end of file diff --git a/WmiLight.UnitTests/Win32_Volume.cs b/WmiLight.UnitTests/Win32_Volume.cs index 2dcd080..f212b1d 100644 --- a/WmiLight.UnitTests/Win32_Volume.cs +++ b/WmiLight.UnitTests/Win32_Volume.cs @@ -222,6 +222,37 @@ public void Win32_Volume_DeviceID_Is_String() } } + [TestMethod] + public void Win32_Volume_DirtyBitSet_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "DirtyBitSet"); + } + } + + [TestMethod] + public void Win32_Volume_DirtyBitSet_Is_Boolean() + { + const string PropertyName = "DirtyBitSet"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + [TestMethod] public void Win32_Volume_DriveLetter_Is_Equal_To_System_Management() { @@ -315,27 +346,6 @@ public void Win32_Volume_FileSystem_Is_String() } } - [TestMethod] - public void Win32_Volume_FreeSpace_Is_UInt64() - { - const string PropertyName = "FreeSpace"; - - using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) - { - object indexerValue = wmiObject[PropertyName]; - - if (indexerValue != null) - Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); - - object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); - - if (noneGenericValue != null) - Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); - - System.UInt64 genericValue = wmiObject.GetPropertyValue(PropertyName); - } - } - [TestMethod] public void Win32_Volume_IndexingEnabled_Is_Equal_To_System_Management() { @@ -491,6 +501,99 @@ public void Win32_Volume_PageFilePresent_Is_Boolean() } } + [TestMethod] + public void Win32_Volume_QuotasEnabled_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "QuotasEnabled"); + } + } + + [TestMethod] + public void Win32_Volume_QuotasEnabled_Is_Boolean() + { + const string PropertyName = "QuotasEnabled"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Volume_QuotasIncomplete_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "QuotasIncomplete"); + } + } + + [TestMethod] + public void Win32_Volume_QuotasIncomplete_Is_Boolean() + { + const string PropertyName = "QuotasIncomplete"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + + [TestMethod] + public void Win32_Volume_QuotasRebuilding_Is_Equal_To_System_Management() + { + using (ManagementBaseObject msObject = WmiHelper.GetFirstSystemManagementObjects(@"root\cimv2", "Win32_Volume")) + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + WmiAssert.AreEqual(msObject, wmiObject, "QuotasRebuilding"); + } + } + + [TestMethod] + public void Win32_Volume_QuotasRebuilding_Is_Boolean() + { + const string PropertyName = "QuotasRebuilding"; + + using (WmiObject wmiObject = WmiHelper.GetFirstWmiLightObjects(@"root\cimv2", "Win32_Volume")) + { + object indexerValue = wmiObject[PropertyName]; + + if (indexerValue != null) + Assert.IsInstanceOfType(indexerValue, $"{nameof(WmiObject)}[\"{PropertyName}\"] returned an unexpected type."); + + object noneGenericValue = wmiObject.GetPropertyValue(PropertyName); + + if (noneGenericValue != null) + Assert.IsInstanceOfType(noneGenericValue, $"{nameof(WmiObject)}.{nameof(wmiObject.GetPropertyValue)}(\"{PropertyName}\") returned an unexpected type."); + + System.Boolean genericValue = wmiObject.GetPropertyValue(PropertyName); + } + } + [TestMethod] public void Win32_Volume_SerialNumber_Is_Equal_To_System_Management() { diff --git a/WmiLight.UnitTestsGenerator/Program.cs b/WmiLight.UnitTestsGenerator/Program.cs index 7daeabd..6ac3c7b 100644 --- a/WmiLight.UnitTestsGenerator/Program.cs +++ b/WmiLight.UnitTestsGenerator/Program.cs @@ -32,19 +32,25 @@ static void Main(string[] args) new Tuple( "root\\cimv2","Win32_Printer" , []), new Tuple( "root\\cimv2","Win32_PhysicalMemory" , []), new Tuple( "root\\cimv2","Win32_Process" , ["KernelModeTime"]), - new Tuple( "root\\cimv2","Win32_Processor" , ["KernelModeTime", "LoadPercentage"]), + new Tuple( "root\\cimv2","Win32_Processor" , ["KernelModeTime", "LoadPercentage", "L3CacheSize"]), new Tuple( "root\\cimv2","Win32_Registry" , ["KernelModeTime", "LoadPercentage"]), - new Tuple( "root\\cimv2","Win32_Service" , []), + new Tuple( "root\\cimv2","Win32_Service" , ["DisconnectedSessions", "TotalSessions"]), new Tuple( "root\\cimv2","Win32_Share" , []), new Tuple( "root\\cimv2","Win32_SystemDriver" , []), new Tuple( "root\\cimv2","Win32_UserAccount" , []), new Tuple( "root\\cimv2","Win32_Volume" , ["FreeSpace"]), new Tuple( "root\\cimv2","Win32_VideoController" , []), - new Tuple( "root\\cimv2","Win32_WinSAT" , []), + new Tuple( "root\\cimv2","Win32_WinSAT" , []), new Tuple( "root\\StandardCimv2","__Provider" , []), new Tuple( "root\\StandardCimv2","CIM_NetworkPort" , []), new Tuple( "root\\StandardCimv2","MSFT_NetAdapter" , []), + + new Tuple( "root\\virtualization\\v2","Msvm_SummaryInformation" , []), + new Tuple( "root\\virtualization\\v2","Msvm_ComputerSystem" , []), + new Tuple( "root\\virtualization\\v2","Msvm_VirtualSystemCapabilities" , []), + + new Tuple( "root\\Microsoft\\Windows\\Storage","MSFT_Volume" , []), }; @@ -60,17 +66,23 @@ static void Main(string[] args) ObjectQuery query = new ObjectQuery($"SELECT * FROM {WMI_CLASS}"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); + HashSet props = new HashSet(); + foreach (var wmiObject in searcher.Get()) { foreach (var prop in wmiObject.Properties) { - var value = prop.Value; - - if (value != null) + if (!props.Contains(prop.Name)) { - if (!propsToNotCompare.Contains(prop.Name)) + var value = prop.Value; + + if (value != null) { - outputFile.Write(@$" + props.Add(prop.Name); + + if (!propsToNotCompare.Contains(prop.Name)) + { + outputFile.Write(@$" [TestMethod] public void {WMI_CLASS}_{prop.Name}_Is_Equal_To_System_Management() {{ @@ -80,10 +92,9 @@ static void Main(string[] args) WmiAssert.AreEqual<{value.GetType()}>(msObject, wmiObject, ""{prop.Name}""); }} }} -"); - } +"); - outputFile.Write(@$" + outputFile.Write(@$" [TestMethod] public void {WMI_CLASS}_{prop.Name}_Is_{value.GetType().Name.Split('.').Last().Replace("[]", "Array")}() {{ @@ -105,10 +116,10 @@ static void Main(string[] args) }} }} "); + } + } } } - - break; } outputFile.Write("\t}\r\n}"); diff --git a/WmiLight.UnitTestsGenerator/Properties/launchSettings.json b/WmiLight.UnitTestsGenerator/Properties/launchSettings.json index 0410590..09fe5bb 100644 --- a/WmiLight.UnitTestsGenerator/Properties/launchSettings.json +++ b/WmiLight.UnitTestsGenerator/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "WmiLight.UnitTestsGenerator": { "commandName": "Project", - "workingDirectory": "$(SolutionDir)WmiLight.UnitTests\\" + "workingDirectory": "$(ProjectDir)..\\WmiLight.UnitTests\\" } } } \ No newline at end of file diff --git a/WmiLight/Internal/NativeMethods.cs b/WmiLight/Internal/NativeMethods.cs index cfe61f7..6a80b7d 100644 --- a/WmiLight/Internal/NativeMethods.cs +++ b/WmiLight/Internal/NativeMethods.cs @@ -121,9 +121,21 @@ public static extern HResult Get( ref VARIANT value, out CimType valueType); - [DllImport("oleaut32.dll", SetLastError = true)] + [DllImport("oleaut32.dll")] public static extern HResult VariantClear(ref VARIANT variant); + [DllImport("oleaut32.dll")] + public static extern HResult SafeArrayGetLBound(IntPtr psa, uint nDim, out int plLbound); + + [DllImport("oleaut32.dll")] + public static extern HResult SafeArrayGetUBound(IntPtr psa, uint nDim, out int plUbound); + + [DllImport("oleaut32.dll")] + public static extern HResult SafeArrayGetElement(IntPtr psa, in int rgIndices, out IntPtr pv); + + [DllImport("oleaut32.dll")] + public static extern uint SafeArrayGetDim(IntPtr psa); + [DllImport("Propsys.dll")] public static extern uint VariantGetElementCount(ref VARIANT variant); diff --git a/WmiLight/Wbem/WbemClassObject.cs b/WmiLight/Wbem/WbemClassObject.cs index 6af649e..8e30e6d 100644 --- a/WmiLight/Wbem/WbemClassObject.cs +++ b/WmiLight/Wbem/WbemClassObject.cs @@ -231,17 +231,33 @@ private static object VariantToObject(ref VARIANT value, CimType type) private static T[] VariantToArray(ref VARIANT value, CimType type) { - uint elementCount = NativeMethods.VariantGetElementCount(ref value); + uint arrayDims = NativeMethods.SafeArrayGetDim(value.Object); - T[] array = new T[elementCount]; + if (arrayDims != 1) + throw new NotSupportedException("Only single-dimensional arrays are supported"); - for (uint i = 0; i < elementCount; i++) + int lBound, uBound; + + HResult hResult = NativeMethods.SafeArrayGetLBound(value.Object, arrayDims, out lBound); + + if (hResult.Failed) + throw (Exception)hResult; + + hResult = NativeMethods.SafeArrayGetUBound(value.Object, arrayDims, out uBound); + + if (hResult.Failed) + throw (Exception)hResult; + + T[] array = new T[uBound - lBound + 1]; + + for (int i = lBound; i <= uBound; i++) { VARIANT variant = default; try { - HResult hResult = NativeMethods.InitVariantFromVariantArrayElem(ref value, i, ref variant); + variant.vt = value.vt & ~VARENUM.VT_ARRAY; + hResult = NativeMethods.SafeArrayGetElement(value.Object, i, out variant.Object); if (hResult.Failed) throw (Exception)hResult; diff --git a/WmiLight/WmiLight.csproj b/WmiLight/WmiLight.csproj index fda3263..16c95ca 100644 --- a/WmiLight/WmiLight.csproj +++ b/WmiLight/WmiLight.csproj @@ -23,7 +23,7 @@ - 6.1.1 + 6.2.0 WmiLight Martin Kuschnik Martin Kuschnik