From c68164f2809b23339db9118dbb3e32df797b749d Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 16 Feb 2016 13:08:25 -0800 Subject: [PATCH] Remove Commands.Omi module This was a temporary work-around that now needs to be removed (mostly because the xUnit tests are out-of-date because we didn't have a runner, and it's not worth it to fix them). Rather than let more cruft accumulate, we need to remove it. Resolves #551 --- .../DscConfiguration.cs | 129 ---------- .../DscLocalConfiguration.cs | 129 ---------- .../GetOmiInstance.cs | 120 --------- .../OmiInterface.cs | 235 ------------------ .../project.json | 20 -- .../test/Get-OmiInstance.Tests.ps1 | 18 -- .../test/Start-DscConfiguration.Tests.ps1 | 43 ---- .../test/sample-cleanup.mof | 19 -- .../test/sample.mof | 22 -- .../test/sampleMeta.mof | 24 -- .../project.json | 4 - test/csharp/test_OmiInterface.cs | 71 ------ 12 files changed, 834 deletions(-) delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/DscConfiguration.cs delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/DscLocalConfiguration.cs delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/GetOmiInstance.cs delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/OmiInterface.cs delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/project.json delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/test/Get-OmiInstance.Tests.ps1 delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/test/sample.mof delete mode 100644 src/Microsoft.PowerShell.Commands.Omi/test/sampleMeta.mof delete mode 100644 test/csharp/test_OmiInterface.cs diff --git a/src/Microsoft.PowerShell.Commands.Omi/DscConfiguration.cs b/src/Microsoft.PowerShell.Commands.Omi/DscConfiguration.cs deleted file mode 100644 index cd2c6d5fc..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/DscConfiguration.cs +++ /dev/null @@ -1,129 +0,0 @@ -/********************************************************************++ -Copyright (c) Microsoft Corporation. All rights reserved. ---********************************************************************/ -using System; -using System.IO; -using System.Text; -using System.Management.Automation; - -namespace Microsoft.PowerShell.Commands.Omi -{ - #region Start-DscConfiguration - - /// - /// implementation for the Start-DscConfiguration command - /// - [Cmdlet( VerbsLifecycle.Start, "DscConfiguration" )] - [OutputType(typeof(object))] - public sealed class StartDscConfigurationCommand : Cmdlet - { - #region parameters - - [Parameter(Mandatory = true)] - [Alias("CM")] - public string ConfigurationMof - { - get - { - return mofPath; - } - set - { - mofPath = value; - } - } - private string mofPath; - - #endregion - - #region methods - - protected override void ProcessRecord() - { - if (mofPath == null) - { - throw new ArgumentNullException(); - } - - if (!Platform.IsLinux()) - { - throw new PlatformNotSupportedException(); - } - - OmiInterface oi = new OmiInterface(); - - const string nameSpace = "root/Microsoft/DesiredStateConfiguration"; - const string instanceName = "{ MSFT_DSCLocalConfigurationManager }"; - const string methodName = "SendConfigurationApply"; - - string mof = File.ReadAllText(mofPath); - byte[] asciiBytes = Encoding.ASCII.GetBytes(mof); - - StringBuilder sb = new StringBuilder(); - sb.Append(" { ConfigurationData [ "); - foreach (byte b in asciiBytes) - { - sb.Append(b.ToString()); - sb.Append(' '); - } - sb.Append("] "); - sb.Append("}"); - string parameters = sb.ToString(); - - string arguments = $"iv {nameSpace} {instanceName} {methodName} {parameters} -xml"; - oi.ExecuteOmiCliCommand(arguments); - - OmiData data = oi.GetOmiData(); - object[] array = data.ToObjectArray(); - - WriteObject(array, true); - - } // EndProcessing - - #endregion - } - - #endregion - - #region Get-DscConfiguration - - /// - /// implementation for the Get-DscConfiguration command - /// - [Cmdlet( VerbsCommon.Get, "DscConfiguration" )] - [OutputType(typeof(object))] - public sealed class GetDscConfigurationCommand : Cmdlet - { - #region methods - - protected override void ProcessRecord() - { - if (!Platform.IsLinux()) - { - throw new PlatformNotSupportedException(); - } - - OmiInterface oi = new OmiInterface(); - - const string nameSpace = "root/Microsoft/DesiredStateConfiguration"; - const string instanceName = "{ MSFT_DSCLocalConfigurationManager }"; - const string methodName = "GetConfiguration"; - - string arguments = $"iv {nameSpace} {instanceName} {methodName} -xml"; - oi.ExecuteOmiCliCommand(arguments); - - OmiData data = oi.GetOmiData(); - object[] array = data.ToObjectArray(); - - WriteObject(array, true); - - } // EndProcessing - - #endregion - } - - #endregion - -} // namespace Microsoft.PowerShell.Commands - - diff --git a/src/Microsoft.PowerShell.Commands.Omi/DscLocalConfiguration.cs b/src/Microsoft.PowerShell.Commands.Omi/DscLocalConfiguration.cs deleted file mode 100644 index 1f5dbe2ce..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/DscLocalConfiguration.cs +++ /dev/null @@ -1,129 +0,0 @@ -/********************************************************************++ -Copyright (c) Microsoft Corporation. All rights reserved. ---********************************************************************/ -using System; -using System.IO; -using System.Text; -using System.Management.Automation; - -namespace Microsoft.PowerShell.Commands.Omi -{ - #region Set-DscLocalConfigurationManager - - /// - /// implementation for the Set-DscLocalConfiguration command - /// - [Cmdlet(VerbsCommon.Set, "DscLocalConfigurationManager" )] - [OutputType(typeof(object))] - public sealed class SetDscLocalConfigurationManagerCommand : Cmdlet - { - #region parameters - - [Parameter(Mandatory = true)] - [Alias("CM")] - public string ConfigurationMof - { - get - { - return mofPath; - } - set - { - mofPath = value; - } - } - private string mofPath; - - #endregion - - #region methods - - protected override void ProcessRecord() - { - if (mofPath == null) - { - throw new ArgumentNullException(); - } - - if (!Platform.IsLinux()) - { - throw new PlatformNotSupportedException(); - } - - OmiInterface oi = new OmiInterface(); - - const string nameSpace = "root/Microsoft/DesiredStateConfiguration"; - const string instanceName = "{ MSFT_DSCLocalConfigurationManager }"; - const string methodName = "SendMetaConfigurationApply"; - - string mof = File.ReadAllText(mofPath); - byte[] asciiBytes = Encoding.ASCII.GetBytes(mof); - - StringBuilder sb = new StringBuilder(); - sb.Append(" { ConfigurationData [ "); - foreach (byte b in asciiBytes) - { - sb.Append(b.ToString()); - sb.Append(' '); - } - sb.Append("] "); - sb.Append("}"); - string parameters = sb.ToString(); - - string arguments = $"iv {nameSpace} {instanceName} {methodName} {parameters} -xml"; - oi.ExecuteOmiCliCommand(arguments); - - OmiData data = oi.GetOmiData(); - object[] array = data.ToObjectArray(); - - WriteObject(array, true); - - } // EndProcessing - - #endregion - } - - #endregion - - #region Get-DscLocalConfigurationManager - - /// - /// implementation for the Get-DscLocalConfigurationManager command - /// - [Cmdlet(VerbsCommon.Get, "DscLocalConfigurationManager" )] - [OutputType(typeof(object))] - public sealed class GetDscLocalConfigurationManagerCommand : Cmdlet - { - #region methods - - protected override void ProcessRecord() - { - if (!Platform.IsLinux()) - { - throw new PlatformNotSupportedException(); - } - - OmiInterface oi = new OmiInterface(); - - const string nameSpace = "root/Microsoft/DesiredStateConfiguration"; - const string instanceName = "{ MSFT_DSCLocalConfigurationManager }"; - const string methodName = "GetMetaConfiguration"; - - string arguments = $"iv {nameSpace} {instanceName} {methodName} -xml"; - oi.ExecuteOmiCliCommand(arguments); - - OmiData data = oi.GetOmiData(); - object[] array = data.ToObjectArray(); - - WriteObject(array, true); - - } // EndProcessing - - #endregion - } - - #endregion - -} // namespace Microsoft.PowerShell.Commands - - diff --git a/src/Microsoft.PowerShell.Commands.Omi/GetOmiInstance.cs b/src/Microsoft.PowerShell.Commands.Omi/GetOmiInstance.cs deleted file mode 100644 index 2546b15db..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/GetOmiInstance.cs +++ /dev/null @@ -1,120 +0,0 @@ -/********************************************************************++ -Copyright (c) Microsoft Corporation. All rights reserved. ---********************************************************************/ -using System; -using System.Xml.Linq; -using System.Collections; -using System.Collections.Generic; -using System.Management.Automation; - -namespace Microsoft.PowerShell.Commands.Omi -{ - #region Get-OmiInstance - - /// - /// implementation for the Get-OmiInstance command - /// - [Cmdlet( VerbsCommon.Get, "OmiInstance" )] - [OutputType(typeof(string))] - [OutputType(typeof(object[]))] - public sealed class GetOmiInstanceCommand : Cmdlet - { - #region parameters - - [Parameter(Mandatory = true)] - [Alias("NS")] - public string Namespace - { - get - { - return nameSpace; - } - set - { - nameSpace = value; - } - } - private string nameSpace; - - [Parameter(Mandatory = true)] - [Alias("CN")] - public string ClassName - { - get - { - return className; - } - set - { - className = value; - } - } - private string className; - - [Parameter] - public string Property - { - get - { - return property; - } - set - { - property = value; - propertySpecified = true; - } - } - private string property; - private bool propertySpecified = false; - - #endregion - - #region methods - - protected override void ProcessRecord() - { - if (nameSpace == null || className == null) - { - throw new ArgumentNullException(); - } - - if (!Platform.IsLinux()) - { - throw new PlatformNotSupportedException(); - } - - OmiInterface oi = new OmiInterface(); - - string arguments = $"ei {nameSpace} {className} -xml"; - oi.ExecuteOmiCliCommand(arguments); - - if (propertySpecified) - { - if (property == null) - { - throw new ArgumentNullException(); - } - - string value; - string type; - oi.GetValue(className, property, out type, out value); - - WriteObject(value); - return; - } - - OmiData data = oi.GetOmiData(); - object[] array = data.ToObjectArray(); - - WriteObject(array, true); - - } // EndProcessing - - #endregion - } - - #endregion - -} // namespace Microsoft.PowerShell.Commands - - diff --git a/src/Microsoft.PowerShell.Commands.Omi/OmiInterface.cs b/src/Microsoft.PowerShell.Commands.Omi/OmiInterface.cs deleted file mode 100644 index dcae1f4b1..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/OmiInterface.cs +++ /dev/null @@ -1,235 +0,0 @@ -/********************************************************************++ -Copyright (c) Microsoft Corporation. All rights reserved. ---********************************************************************/ - -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Xml.Linq; -using System.Runtime.InteropServices; -using System.Management.Automation; - -namespace Microsoft.PowerShell.Commands.Omi -{ - internal static class Platform - { - internal static bool IsLinux() - { - return RuntimeInformation.IsOSPlatform(OSPlatform.Linux); - } - - internal static bool IsWindows() - { - return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - } - } - - /// - /// Data from OMI - /// - public class OmiData - { - public HashSet Properties; - public HashSet> Values; - public OmiData() - { - Properties = new HashSet(); - Values = new HashSet>(); - } - public void Debug() - { - foreach (string p in Properties) - { - Console.Write("{0,-22}", p); - } - Console.WriteLine(); - - foreach (Dictionary d in Values) - { - foreach (string p in Properties) - { - string value = String.Empty; - if (d.ContainsKey(p)) - { - value = Truncate(d[p], 16); - } - Console.Write("{0,-22}", value); - } - Console.WriteLine(); - } - } - - public Object[] ToObjectArray() - { - // Convert to array of objects - ArrayList array = new ArrayList(); - foreach (Dictionary d in Values) - { - PSObject o = new PSObject(); - - foreach (string p in Properties) - { - string value = String.Empty; - if (d.ContainsKey(p)) - { - value = d[p]; - } - PSNoteProperty psp = new PSNoteProperty(p, value); - o.Members.Add(psp); - } - array.Add(o); - } - - return (Object[])(array.ToArray()); - } - - private string Truncate(string s, int maxChars) - { - return s.Length < maxChars ? s : s.Substring(0, maxChars) + " ..."; - } - } - - /// - /// Interfaces that cmdlets can use to interface with OMI - /// - public class OmiInterface - { - private string _xmlString = null; - - public void ExecuteOmiCliCommand(string arguments) - { - using (Process process = new Process()) - { - // Assume omicli is somewhere in PATH... - process.StartInfo.FileName = "omicli"; - process.StartInfo.Arguments = arguments; - process.StartInfo.UseShellExecute = false; - process.StartInfo.RedirectStandardOutput = true; - process.StartInfo.CreateNoWindow = true; - - process.Start(); - - string output = process.StandardOutput.ReadToEnd(); - - process.WaitForExit(); - if (process.ExitCode != 0) - { - throw new IOException(); - } - - _xmlString = $"{output}"; - } - return; - } - - public void GetValue(string className, string propertyName, out string type, out string value) - { - // parse xml - XElement cim = XElement.Parse(_xmlString); - - IEnumerable elements = - from el in cim.Elements("INSTANCE") - where (string)el.Attribute("CLASSNAME") == className - select el; - - IEnumerable properties = - from el in elements.First().Elements("PROPERTY") - where (string)el.Attribute("NAME") == propertyName - select el; - - XElement property = properties.First(); - XElement p = property.Element("VALUE"); - - type = (string)property.Attribute("TYPE"); - value = p.Value; - } - - private IEnumerable GetValueIEnumerable() - { - // parse xml - XElement cim = XElement.Parse(_xmlString); - - IEnumerable elements = cim.Elements(); - return elements; - } - - public OmiData GetOmiData() - { - OmiData data = new OmiData(); - - const string VALUE = "VALUE"; - const string VALUEARRAY = "VALUE.ARRAY"; - const string PROPERTY = "PROPERTY"; - const string PROPERTYARRAY = "PROPERTY.ARRAY"; - - IEnumerable instances = GetValueIEnumerable(); - foreach (XElement instance in instances) - { - // First, do PROPERTY elements - IEnumerable properties = instance.Elements(PROPERTY); - - foreach (XElement property in properties) - { - Dictionary d = new Dictionary(); - IEnumerable attrs = property.Attributes(); - - foreach (XAttribute attr in attrs) - { - data.Properties.Add(attr.Name.LocalName); - d[attr.Name.LocalName] = attr.Value; - } - - // Now look for "VALUE" sub-element - IEnumerable values = property.Elements(VALUE); - foreach (XElement value in values) - { - data.Properties.Add(VALUE); - d[VALUE] = value.Value; - } - - data.Values.Add(d); - } - - // Next, do PROPERTY.ARRAY elements - IEnumerable propertyArrays = instance.Elements(PROPERTYARRAY); - foreach (XElement property in propertyArrays) - { - Dictionary dCommon = new Dictionary(); - IEnumerable attrs = property.Attributes(); - - foreach (XAttribute attr in attrs) - { - data.Properties.Add(attr.Name.LocalName); - dCommon[attr.Name.LocalName] = attr.Value; - } - - IEnumerable valueArrays = property.Elements(VALUEARRAY); - - if (valueArrays.Count() > 0) - { - foreach (XElement valueArray in valueArrays) - { - IEnumerable values = valueArray.Elements(VALUE); - foreach (XElement value in values) - { - Dictionary d = new Dictionary(dCommon); - data.Properties.Add(VALUE); - d[VALUE] = value.Value; - data.Values.Add(d); - } - } - } - else - { - data.Values.Add(dCommon); - } - } - } - - return data; - } - } -} diff --git a/src/Microsoft.PowerShell.Commands.Omi/project.json b/src/Microsoft.PowerShell.Commands.Omi/project.json deleted file mode 100644 index b7af3aeb2..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Microsoft.PowerShell.Commands.Omi Library", - "authors": [ "palladia", "andschwa" ], - - "dependencies": { - "System.Management.Automation": { - "type": "build", - "version": "1.0.0-*" - } - }, - - "frameworks": { - "dnxcore50": { - "dependencies": { - "System.Xml.XDocument": "4.0.11-rc3-23729" - } - } - } -} diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/Get-OmiInstance.Tests.ps1 b/src/Microsoft.PowerShell.Commands.Omi/test/Get-OmiInstance.Tests.ps1 deleted file mode 100644 index 3665ab62c..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/test/Get-OmiInstance.Tests.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -# Note that omicli must be in PATH and omiserver should be started with -# --ignoreAuthentication option - -Describe "Get-OmiInstance" { - Import-Module Microsoft.PowerShell.Commands.Omi - - It "Should execute basic command correctly" { - $instance = Get-OmiInstance -NameSpace root/omi -ClassName OMI_Identify - - # This test is a workaround - $instance.Value.Contains("OMI") | Should Be $true - - # TODO: test these when available - #$instance.ProductName | Should Be "OMI" - #$instance.ProductVendor | Should Be "Microsoft" - #$instance.OperatingSystem | Should Be "LINUX" - } -} diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 b/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 deleted file mode 100644 index e0739ab96..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/test/Start-DscConfiguration.Tests.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -# Note that omicli must be in PATH and omiserver should be started with -# --ignoreAuthentication option - -$here = Split-Path -Parent $MyInvocation.MyCommand.Path -$mof = "$here/sample.mof" -$mofCleanup = "$here/sample-cleanup.mof" -$mofMeta = "$here/sampleMeta.mof" -$file = "/tmp/linux.txt" - -Describe "DscConfiguration" { - Import-Module Microsoft.PowerShell.Commands.Omi - - It "Should create file per sample MOF file" { - $s = Start-DscConfiguration -ConfigurationMof $mof | - Where-Object {$_.NAME -eq "ReturnValue"} - $s.VALUE | Should Be "0" - $file | Should Exist - } - - It "Should get DSC configuration successfully" { - $s = Get-DscConfiguration | Where-Object {$_.NAME -eq "ReturnValue"} - $s.VALUE | Should Be "0" - } - - It "Should remove temp file just created" { - $s = Start-DscConfiguration -ConfigurationMof $mofCleanup | - Where-Object {$_.NAME -eq "ReturnValue"} - $s.VALUE | Should Be "0" - $file | Should Not Exist - } - - It "Should set Meta MOF file properly" { - $s = Set-DscLocalConfigurationManager -ConfigurationMof $mofMeta | - Where-Object {$_.NAME -eq "ReturnValue"} - $s.VALUE | Should Be "0" - } - - It "Should get DSC local configuration successfully" { - $s = Get-DscLocalConfigurationManager | Where-Object {$_.NAME -eq "ReturnValue"} - $s.VALUE | Should Be "0" - } - -} diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof b/src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof deleted file mode 100644 index c1202308e..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/test/sample-cleanup.mof +++ /dev/null @@ -1,19 +0,0 @@ -instance of MSFT_nxFileResource -{ - Contents = "my contents"; - DestinationPath = "/tmp/linux.txt"; - Ensure = "Absent"; - Type = "File"; - ResourceId = "[MSFT_nxFileResource]File1"; - ModuleName = "nx"; - ModuleVersion = "1.0"; - - -}; - -instance of OMI_ConfigurationDocument -{ - Version="1.0.0"; - -}; - diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/sample.mof b/src/Microsoft.PowerShell.Commands.Omi/test/sample.mof deleted file mode 100644 index cb2d4b33d..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/test/sample.mof +++ /dev/null @@ -1,22 +0,0 @@ -instance of MSFT_nxFileResource -{ - Contents = "my contents"; - DestinationPath = "/tmp/linux.txt"; - Ensure = "Present"; - Type = "File"; - Owner = "root"; - Group = "root"; - Mode = "644"; - ResourceId = "[MSFT_nxFileResource]File1"; - ModuleName = "nx"; - ModuleVersion = "1.0"; - - -}; - -instance of OMI_ConfigurationDocument -{ - Version="1.0.0"; - -}; - diff --git a/src/Microsoft.PowerShell.Commands.Omi/test/sampleMeta.mof b/src/Microsoft.PowerShell.Commands.Omi/test/sampleMeta.mof deleted file mode 100644 index f811287cc..000000000 --- a/src/Microsoft.PowerShell.Commands.Omi/test/sampleMeta.mof +++ /dev/null @@ -1,24 +0,0 @@ -/* -@TargetNode='10.199.192.181' -@GeneratedBy=johnkord -@GenerationDate=01/15/2015 14:34:29 -@GenerationHost=JKORDIC-1 -*/ - - -instance of MSFT_DSCMetaConfiguration as $MSFT_DSCMetaConfiguration1ref -{ -DownloadManagerName = "WebDownloadManager"; -RefreshMode = "Push"; -ConfigurationMode = "ApplyAndAutoCorrect"; - -}; - -instance of OMI_ConfigurationDocument -{ -Version="1.0.0"; -Author="johnkord"; -GenerationDate="01/15/2015 14:34:29"; -GenerationHost="JKORDIC-1"; -}; - diff --git a/src/Microsoft.PowerShell.Linux.Host/project.json b/src/Microsoft.PowerShell.Linux.Host/project.json index 1230eb868..9f2ea741f 100644 --- a/src/Microsoft.PowerShell.Linux.Host/project.json +++ b/src/Microsoft.PowerShell.Linux.Host/project.json @@ -14,10 +14,6 @@ "type": "build", "version": "1.0.0-*" }, - "Microsoft.PowerShell.Commands.Omi": { - "type": "build", - "version": "1.0.0-*" - }, "Microsoft.PowerShell.Commands.Utility": { "type": "build", "version": "1.0.0-*" diff --git a/test/csharp/test_OmiInterface.cs b/test/csharp/test_OmiInterface.cs deleted file mode 100644 index d95b0a320..000000000 --- a/test/csharp/test_OmiInterface.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Xunit; -using System; -using System.Management.Automation; -using System.Diagnostics; -using System.Collections.Generic; -using System.Linq; -using System.Xml.Linq; - -namespace PSTests -{ - public static class OmiInterfaceTests - { - [Fact] - public static void TestHostName() - { - const string ns = "root/omi"; - const string cn = "OMI_Identify"; - const string property = "SystemName"; - - string expected = null; - - var startInfo = new ProcessStartInfo - { - FileName = @"/usr/bin/env", - Arguments = "hostname", - RedirectStandardOutput = true, - UseShellExecute = false - }; - using (Process process = Process.Start(startInfo)) - { - // Get output of call to hostname without trailing newline - expected = process.StandardOutput.ReadToEnd().Trim(); - process.WaitForExit(); - - // The process should return an exit code of 0 on success - Assert.Equal(0, process.ExitCode); - } - - string value = null; - OmiInterface oi = new OmiInterface(); - oi.GetOmiValue(ns, cn, property, out value); - Assert.Equal(expected, value); - } - - [Fact] - public static void TestXHugeNumberEnumerable() - { - const string ns = "interop"; - const string cn = "X_HugeNumber"; - - OmiInterface oi = new OmiInterface(); - IEnumerable elements; - oi.GetOmiValues(ns, cn, out elements); - Assert.True(elements.FirstOrDefault() != null); - } - - [Fact] - public static void TestXHugeNumberOmiData() - { - const string ns = "interop"; - const string cn = "X_HugeNumber"; - - OmiInterface oi = new OmiInterface(); - - OmiData data; - oi.GetOmiValues(ns, cn, out data); - Assert.True(data != null); - Assert.Equal(data.Values.Count(), 22); - } - } -}