Author: twiest
Date: 2007-02-11 04:34:27 -0500 (Sun, 11 Feb 2007)
New Revision: 72608
Added:
trunk/wbem-sharp/tests/nunit/
trunk/wbem-sharp/tests/nunit/FakeCimom.cs
trunk/wbem-sharp/tests/nunit/OpSettings/
trunk/wbem-sharp/tests/nunit/OpSettings/AssociatorNamesOpSettingsTest.cs
trunk/wbem-sharp/tests/nunit/OpSettings/GetClassOpSettingsTest.cs
trunk/wbem-sharp/tests/nunit/Program.cs
trunk/wbem-sharp/tests/nunit/Properties/
trunk/wbem-sharp/tests/nunit/Properties/AssemblyInfo.cs
trunk/wbem-sharp/tests/nunit/WbemClientTest.cs
trunk/wbem-sharp/tests/nunit/wbem-tests.csproj
Modified:
trunk/wbem-sharp/src/Batch/SingleRequest.cs
trunk/wbem-sharp/src/CimXml/CreateRequest.cs
trunk/wbem-sharp/src/Net/CimomRequest.cs
trunk/wbem-sharp/src/Net/CimomResponse.cs
trunk/wbem-sharp/src/OpSettings/AssociatorNamesOpSettings.cs
trunk/wbem-sharp/src/WbemClient.cs
trunk/wbem-sharp/wbem-sharp.sln
Log:
* Added the initial nunit testcases.
* Made minor changes to the classes being tested to make them easier to test
(for instance, I changed some of them to have protected properties instead of
private so that the testcase can see internal data if need be.
Modified: trunk/wbem-sharp/src/Batch/SingleRequest.cs
===================================================================
--- trunk/wbem-sharp/src/Batch/SingleRequest.cs 2007-02-11 09:24:19 UTC (rev
72607)
+++ trunk/wbem-sharp/src/Batch/SingleRequest.cs 2007-02-11 09:34:27 UTC (rev
72608)
@@ -79,7 +79,7 @@
#region Properties and Indexers
/// <summary>
- /// Overrides the default Namespace
+ /// Temporarily Overrides the default Namespace
/// </summary>
public CimName Namespace
{
@@ -90,7 +90,7 @@
/// <summary>
/// Type of Operation
/// </summary>
- internal RequestType ReqType
+ protected internal RequestType ReqType
{
get { return _reqType; }
set { _reqType = value; }
Modified: trunk/wbem-sharp/src/CimXml/CreateRequest.cs
===================================================================
--- trunk/wbem-sharp/src/CimXml/CreateRequest.cs 2007-02-11 09:24:19 UTC
(rev 72607)
+++ trunk/wbem-sharp/src/CimXml/CreateRequest.cs 2007-02-11 09:34:27 UTC
(rev 72608)
@@ -64,7 +64,6 @@
tmpNameSpace = curOp.Namespace;
cxw.WriteSimpleReqElement();
-
switch (curOp.ReqType)
{
Modified: trunk/wbem-sharp/src/Net/CimomRequest.cs
===================================================================
--- trunk/wbem-sharp/src/Net/CimomRequest.cs 2007-02-11 09:24:19 UTC (rev
72607)
+++ trunk/wbem-sharp/src/Net/CimomRequest.cs 2007-02-11 09:34:27 UTC (rev
72608)
@@ -126,15 +126,7 @@
{
if (OnCimomRequest != null)
{
- //if ((OnCimomRequest.Target is System.Windows.Forms.Control)
&&
- //
((System.Windows.Forms.Control)OnCimomRequest.Target).InvokeRequired)
- //{
- // OnCimomRequest.Invoke(Message);
- //}
- //else
- //{
- OnCimomRequest(Message);
- //}
+ OnCimomRequest(Message);
}
// ------------- Convert the message to a byte array, put it into
the send stream, and send it -------------
Modified: trunk/wbem-sharp/src/Net/CimomResponse.cs
===================================================================
--- trunk/wbem-sharp/src/Net/CimomResponse.cs 2007-02-11 09:24:19 UTC (rev
72607)
+++ trunk/wbem-sharp/src/Net/CimomResponse.cs 2007-02-11 09:34:27 UTC (rev
72608)
@@ -1,3 +1,33 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2007 Novell Inc., www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+
+// Authors:
+// Thomas Wiest ([EMAIL PROTECTED])
+// Rusty Howell ([EMAIL PROTECTED])
+//
+// (C) Novell Inc.
+
+
using System;
using System.IO;
using System.Net;
@@ -34,49 +64,11 @@
if (OnCimomResponse != null)
{
- //if ((OnCimomResponse.Target is System.Windows.Forms.Control)
&&
- //
((System.Windows.Forms.Control)OnCimomResponse.Target).InvokeRequired)
- //{
- // OnCimomResponse.Invoke((int)this.StatusCode, Message);
- //}
- //else
- //{
- OnCimomResponse((int)this.StatusCode, Message);
- //}
+ OnCimomResponse((int)this.StatusCode, Message);
}
}
#endregion
-
/******************************************************************************
-* The MIT License
-* Copyright (c) 2007 Novell Inc., www.novell.com
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the Software), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in
-* all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*******************************************************************************/
- // Authors:
- // Thomas Wiest ([EMAIL PROTECTED])
- // Rusty Howell ([EMAIL PROTECTED])
- //
- // (C) Novell Inc.
-
-
-
#region Properties and Indexers
public HttpStatusCode StatusCode
{
Modified: trunk/wbem-sharp/src/OpSettings/AssociatorNamesOpSettings.cs
===================================================================
--- trunk/wbem-sharp/src/OpSettings/AssociatorNamesOpSettings.cs
2007-02-11 09:24:19 UTC (rev 72607)
+++ trunk/wbem-sharp/src/OpSettings/AssociatorNamesOpSettings.cs
2007-02-11 09:34:27 UTC (rev 72608)
@@ -42,21 +42,12 @@
CimName _resultClass;
string _role;
string _resultRole;
- private int myVar;
- public int MyProperty
- {
- get { return myVar; }
- set { myVar = value; }
- }
-
-
#region Constructors
public AssociatorNamesOpSettings()
{
ReqType = RequestType.AssociatorNames;
- //ObjectName = objectName;
AssocClass = null;
ResultClass = null;
Role = null;
Modified: trunk/wbem-sharp/src/WbemClient.cs
===================================================================
--- trunk/wbem-sharp/src/WbemClient.cs 2007-02-11 09:24:19 UTC (rev 72607)
+++ trunk/wbem-sharp/src/WbemClient.cs 2007-02-11 09:34:27 UTC (rev 72608)
@@ -40,7 +40,7 @@
namespace Wbem
{
#region Delegates
- public delegate void CimDataTypeHandler(CimXmlHeader header, object
CimObject);
+ public delegate void CimDataTypeHandler(CimXmlHeader header, object
CimObject);
#endregion
/// <summary>
@@ -48,6 +48,9 @@
/// </summary>
public class WbemClient
{
+ protected delegate string FakeCimomHandler(string request);
+
+
string _hostname;
int _port;
CimName _defaultNamespace;
@@ -55,8 +58,11 @@
bool _isSecure;
bool _isAuthenticated;
ICertificatePolicy _certificatePolicy;
+ FakeCimomHandler _fakeCimom;
+
+
/// <summary>
///
/// </summary>
@@ -86,7 +92,8 @@
DefaultNamespace = defaultNamespace;
IsSecure = true;
- _isAuthenticated = false;
+ IsAuthenticated = false;
+ FakeCimom = null;
}
#endregion
@@ -144,11 +151,19 @@
get { return _isSecure; }
set { _isSecure = value; }
}
+
public bool IsAuthenticated
{
get { return _isAuthenticated; }
+ private set { _isAuthenticated = value; }
}
+ protected FakeCimomHandler FakeCimom
+ {
+ get { return _fakeCimom; }
+ set { _fakeCimom = value; }
+ }
+
public string Url
{
get
@@ -1277,32 +1292,42 @@
private string ExecuteRequest(string cimOperation, string cimMessage)
{
- CimomResponse cimResp = null;
+ string response = string.Empty;
- CimomRequest cimReq;
+ if (FakeCimom != null)
+ {
+ // Use the fake cimom for unit testing
+ response = FakeCimom(cimMessage);
+ }
+ else
+ {
+ CimomResponse cimResp = null;
- cimReq = new CimomRequest(this.Url, this.CertificatePolicy);
+ CimomRequest cimReq;
- cimReq.Credentials = this.Credentials;
+ cimReq = new CimomRequest(this.Url, this.CertificatePolicy);
- // Optional
- cimReq.Headers.Add(cimReq.NameSpaceValue.ToString() +
"-CIMOperation", "MethodCall");
- cimReq.Headers.Add(cimReq.NameSpaceValue.ToString() +
"-CIMMethod", cimOperation);
- cimReq.Headers.Add(cimReq.NameSpaceValue.ToString() +
"-CIMObject", this.DefaultNamespace.ToString());
+ cimReq.Credentials = this.Credentials;
- // Put the message in the send buffer.
- cimReq.Message = cimMessage;
+ // Optional
+ cimReq.Headers.Add(cimReq.NameSpaceValue.ToString() +
"-CIMOperation", "MethodCall");
+ cimReq.Headers.Add(cimReq.NameSpaceValue.ToString() +
"-CIMMethod", cimOperation);
+ cimReq.Headers.Add(cimReq.NameSpaceValue.ToString() +
"-CIMObject", this.DefaultNamespace.ToString());
- // Send the buffer, and get the response.
- cimResp = cimReq.GetResponse();
+ // Put the message in the send buffer.
+ cimReq.Message = cimMessage;
- // Grab the message from the response buffer.
- string response = cimResp.Message;
+ // Send the buffer, and get the response.
+ cimResp = cimReq.GetResponse();
- // See if an error occurred
- if ((int)cimResp.StatusCode != 200)
- return null;
+ // Grab the message from the response buffer.
+ response = cimResp.Message;
+ // See if an error occurred
+ if ((int)cimResp.StatusCode != 200)
+ return null;
+ }
+
return response;
}
Property changes on: trunk/wbem-sharp/tests/nunit
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Added: trunk/wbem-sharp/tests/nunit/FakeCimom.cs
===================================================================
--- trunk/wbem-sharp/tests/nunit/FakeCimom.cs 2007-02-11 09:24:19 UTC (rev
72607)
+++ trunk/wbem-sharp/tests/nunit/FakeCimom.cs 2007-02-11 09:34:27 UTC (rev
72608)
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WbemTests
+{
+ public class FakeCimom
+ {
+ const string GetClassReq = "<?xml version=\"1.0\" encoding=\"utf-8\"
standalone=\"no\"?>\r\n<CIM DTDVERSION=\"2.0\" CIMVERSION=\"2.0\">\r\n
<MESSAGE ID=\"1\" PROTOCOLVERSION=\"1.0\">\r\n <SIMPLEREQ>\r\n
<IMETHODCALL NAME=\"GetClass\">\r\n <LOCALNAMESPACEPATH>\r\n
<NAMESPACE NAME=\"namespace\" />\r\n </LOCALNAMESPACEPATH>\r\n
<IPARAMVALUE NAME=\"IncludeClassOrigin\">\r\n <VALUE>FALSE</VALUE>\r\n
</IPARAMVALUE>\r\n <IPARAMVALUE NAME=\"ClassName\">\r\n
<CLASSNAME NAME=\"CIM_Component\" />\r\n </IPARAMVALUE>\r\n
<IPARAMVALUE NAME=\"IncludeQualifiers\">\r\n <VALUE>TRUE</VALUE>\r\n
</IPARAMVALUE>\r\n <IPARAMVALUE NAME=\"LocalOnly\">\r\n
<VALUE>TRUE</VALUE>\r\n </IPARAMVALUE>\r\n </IMETHODCALL>\r\n
</SIMPLEREQ>\r\n </MESSAGE>\r\n</CIM>";
+ const string GetClassResp = "<?xml version=\"1.0\" ?><CIM
CIMVERSION=\"2.0\" DTDVERSION=\"2.0\"><MESSAGE ID=\"1\"
PROTOCOLVERSION=\"1.0\"><SIMPLERSP><IMETHODRESPONSE
NAME=\"GetClass\"><IRETURNVALUE><CLASS NAME=\"CIM_Component\"><QUALIFIER
NAME=\"Association\" TYPE=\"boolean\" OVERRIDABLE=\"false\"
><VALUE>true</VALUE></QUALIFIER><QUALIFIER NAME=\"Abstract\" TYPE=\"boolean\"
TOSUBCLASS=\"false\" ><VALUE>true</VALUE></QUALIFIER><QUALIFIER
NAME=\"Aggregation\" TYPE=\"boolean\" OVERRIDABLE=\"false\"
><VALUE>true</VALUE></QUALIFIER><QUALIFIER NAME=\"Version\" TYPE=\"string\"
TOSUBCLASS=\"false\" TRANSLATABLE=\"true\"
><VALUE>2.7.0</VALUE></QUALIFIER><QUALIFIER NAME=\"Description\"
TYPE=\"string\" TRANSLATABLE=\"true\" ><VALUE>CIM_Component is a generic
association used to establish 'part of' relationships between Managed
Elements. For example, it could be used to define the components or parts of a
System.</VALUE></QUALIFIER><PROPERTY.REFERENCE NAME=\"GroupCompo
nent\" REFERENCECLASS=\"CIM_ManagedElement\" ><QUALIFIER NAME=\"Key\"
TYPE=\"boolean\" OVERRIDABLE=\"false\"
><VALUE>true</VALUE></QUALIFIER><QUALIFIER NAME=\"Aggregate\" TYPE=\"boolean\"
OVERRIDABLE=\"false\" ><VALUE>true</VALUE></QUALIFIER><QUALIFIER
NAME=\"Description\" TYPE=\"string\" TRANSLATABLE=\"true\" ><VALUE>The parent
element in the
association.</VALUE></QUALIFIER></PROPERTY.REFERENCE><PROPERTY.REFERENCE
NAME=\"PartComponent\" REFERENCECLASS=\"CIM_ManagedElement\" ><QUALIFIER
NAME=\"Key\" TYPE=\"boolean\" OVERRIDABLE=\"false\"
><VALUE>true</VALUE></QUALIFIER><QUALIFIER NAME=\"Description\" TYPE=\"string\"
TRANSLATABLE=\"true\" ><VALUE>The child element in the
association.</VALUE></QUALIFIER></PROPERTY.REFERENCE></CLASS></IRETURNVALUE></IMETHODRESPONSE></SIMPLERSP></MESSAGE></CIM>\r\n";
+
+ public static string GetResponse(string request)
+ {
+ switch (SetMessageIdToOne(request))
+ {
+ case FakeCimom.GetClassReq:
+ return GetClassResp;
+
+ default:
+ throw (new ApplicationException("Unknown Request was made
to the fake cimom"));
+ }
+ }
+
+ private static string SetMessageIdToOne(string request)
+ {
+ string resp = request.Substring(0, 112);
+ resp += "1";
+
+ int startPos = 113;
+ while (request[startPos] != '"')
+ {
+ startPos++;
+ }
+
+ resp += request.Substring(startPos);
+
+ return resp;
+ }
+ }
+}
Added: trunk/wbem-sharp/tests/nunit/OpSettings/AssociatorNamesOpSettingsTest.cs
===================================================================
--- trunk/wbem-sharp/tests/nunit/OpSettings/AssociatorNamesOpSettingsTest.cs
2007-02-11 09:24:19 UTC (rev 72607)
+++ trunk/wbem-sharp/tests/nunit/OpSettings/AssociatorNamesOpSettingsTest.cs
2007-02-11 09:34:27 UTC (rev 72608)
@@ -0,0 +1,86 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2007 Novell Inc., www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+
+// Authors:
+// Thomas Wiest ([EMAIL PROTECTED])
+// Rusty Howell ([EMAIL PROTECTED])
+//
+// (C) Novell Inc.
+
+using Wbem;
+using NUnit.Framework;
+using Wbem.Batch;
+
+namespace WbemTests
+{
+ [TestFixture]
+ public class AssociatorNamesOpSettingsTest : AssociatorNamesOpSettings
+ {
+ [Test]
+ public void CheckDefaults()
+ {
+ Assert.AreEqual(RequestType.AssociatorNames, this.ReqType);
+ Assert.AreEqual(null, this.Namespace);
+
+ // Check Default Values are set to DMTF standard
+ Assert.AreEqual(null, this.AssocClass);
+ Assert.AreEqual(null, this.ObjectName);
+ Assert.AreEqual(null, this.ResultClass);
+ Assert.AreEqual(null, this.ResultRole);
+ Assert.AreEqual(null, this.Role);
+ }
+ }
+
+ [TestFixture]
+ public class AssociatorNamesWithClassNameOpSettingsTest :
AssociatorNamesWithClassNameOpSettings
+ {
+ public AssociatorNamesWithClassNameOpSettingsTest() : base("none")
+ {
+ }
+
+ [Test]
+ public void CheckDefaults()
+ {
+ // Check Default Values are set to DMTF standard
+ Assert.AreEqual("none", this.ClassName.ToString());
+ Assert.AreEqual(typeof(CimName), this.ObjectName.GetType());
+ }
+ }
+
+
+ [TestFixture]
+ public class AssociatorNamesWithInstanceNameOpSettingsTest :
AssociatorNamesWithInstanceNameOpSettings
+ {
+ public AssociatorNamesWithInstanceNameOpSettingsTest() : base(new
CimInstanceName("none"))
+ {
+ }
+
+ [Test]
+ public void CheckDefaults()
+ {
+ // Check Default Values are set to DMTF standard
+ Assert.AreEqual("none", this.InstanceName.ClassName.ToString());
+ Assert.AreEqual(typeof(CimInstanceName),
this.ObjectName.GetType());
+ }
+ }
+}
\ No newline at end of file
Added: trunk/wbem-sharp/tests/nunit/OpSettings/GetClassOpSettingsTest.cs
===================================================================
--- trunk/wbem-sharp/tests/nunit/OpSettings/GetClassOpSettingsTest.cs
2007-02-11 09:24:19 UTC (rev 72607)
+++ trunk/wbem-sharp/tests/nunit/OpSettings/GetClassOpSettingsTest.cs
2007-02-11 09:34:27 UTC (rev 72608)
@@ -0,0 +1,57 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2007 Novell Inc., www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+
+// Authors:
+// Thomas Wiest ([EMAIL PROTECTED])
+// Rusty Howell ([EMAIL PROTECTED])
+//
+// (C) Novell Inc.
+
+using Wbem;
+using NUnit.Framework;
+
+namespace WbemTests
+{
+ [TestFixture]
+ public class GetClassOpSettingsTest : GetClassOpSettings
+ {
+ public GetClassOpSettingsTest() : base("none")
+ {
+ }
+
+ [Test]
+ public void CheckDefaults()
+ {
+ Assert.AreEqual(RequestType.GetClass, this.ReqType);
+ Assert.AreEqual("none", this.ClassName.ToString());
+
+ // Check Default Values are set to DMTF standard
+
+ Assert.AreEqual(false, this.IncludeClassOrigin);
+ Assert.AreEqual(true, this.IncludeQualifiers);
+ Assert.AreEqual(true, this.LocalOnly);
+ Assert.AreEqual(null, this.Namespace);
+ Assert.AreEqual(null, this.PropertyList);
+ }
+ }
+}
Added: trunk/wbem-sharp/tests/nunit/Program.cs
===================================================================
--- trunk/wbem-sharp/tests/nunit/Program.cs 2007-02-11 09:24:19 UTC (rev
72607)
+++ trunk/wbem-sharp/tests/nunit/Program.cs 2007-02-11 09:34:27 UTC (rev
72608)
@@ -0,0 +1,14 @@
+using System;
+
+namespace WbemTests
+{
+ class Program
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ string[] args2 = { System.Environment.CurrentDirectory +
"\\wbem-tests.exe" };
+ NUnit.Gui.AppEntry.Main(args2);
+ }
+ }
+}
Added: trunk/wbem-sharp/tests/nunit/Properties/AssemblyInfo.cs
===================================================================
--- trunk/wbem-sharp/tests/nunit/Properties/AssemblyInfo.cs 2007-02-11
09:24:19 UTC (rev 72607)
+++ trunk/wbem-sharp/tests/nunit/Properties/AssemblyInfo.cs 2007-02-11
09:34:27 UTC (rev 72608)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("wbem-tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("wbem-tests")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed
to COM
+[assembly: Guid("975b2e63-60dd-4428-a132-294d93139408")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build
Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: trunk/wbem-sharp/tests/nunit/WbemClientTest.cs
===================================================================
--- trunk/wbem-sharp/tests/nunit/WbemClientTest.cs 2007-02-11 09:24:19 UTC
(rev 72607)
+++ trunk/wbem-sharp/tests/nunit/WbemClientTest.cs 2007-02-11 09:34:27 UTC
(rev 72608)
@@ -0,0 +1,49 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2007 Novell Inc., www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+
+// Authors:
+// Thomas Wiest ([EMAIL PROTECTED])
+// Rusty Howell ([EMAIL PROTECTED])
+//
+// (C) Novell Inc.
+
+using Wbem;
+using NUnit.Framework;
+
+namespace WbemTests
+{
+ [TestFixture]
+ public class WbemClientTest : WbemClient
+ {
+ public WbemClientTest(): base("host", "user", "password", "namespace")
+ {
+ this.FakeCimom = WbemTests.FakeCimom.GetResponse;
+ }
+
+ [Test]
+ public void GetClassTest()
+ {
+ CimClass cc = this.GetClass("CIM_Component");
+ }
+ }
+}
\ No newline at end of file
Added: trunk/wbem-sharp/tests/nunit/wbem-tests.csproj
===================================================================
--- trunk/wbem-sharp/tests/nunit/wbem-tests.csproj 2007-02-11 09:24:19 UTC
(rev 72607)
+++ trunk/wbem-sharp/tests/nunit/wbem-tests.csproj 2007-02-11 09:34:27 UTC
(rev 72608)
@@ -0,0 +1,60 @@
+<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{FACEAE0F-B8C5-4B34-B95F-90419A7DDC3B}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>WbemTests</RootNamespace>
+ <AssemblyName>wbem-tests</AssemblyName>
+ <StartupObject>WbemTests.Program</StartupObject>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'
">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit-gui-runner, Version=2.2.9.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+ <Reference Include="nunit.framework, Version=2.2.9.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="FakeCimom.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="OpSettings\AssociatorNamesOpSettingsTest.cs" />
+ <Compile Include="OpSettings\GetClassOpSettingsTest.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="WbemClientTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\wbem-sharp.csproj">
+ <Project>{C1AB09FA-82A4-47A2-AFD4-80235928BB9A}</Project>
+ <Name>wbem-sharp</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets
below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
Modified: trunk/wbem-sharp/wbem-sharp.sln
===================================================================
--- trunk/wbem-sharp/wbem-sharp.sln 2007-02-11 09:24:19 UTC (rev 72607)
+++ trunk/wbem-sharp/wbem-sharp.sln 2007-02-11 09:34:27 UTC (rev 72608)
@@ -5,6 +5,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExampleRunner",
"examples\ExampleRunner.csproj", "{9DC965DB-37BE-410B-AC4F-762F11BAF637}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wbem-tests",
"tests\nunit\wbem-tests.csproj", "{FACEAE0F-B8C5-4B34-B95F-90419A7DDC3B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -19,6 +21,10 @@
{9DC965DB-37BE-410B-AC4F-762F11BAF637}.Debug|Any CPU.Build.0 =
Debug|Any CPU
{9DC965DB-37BE-410B-AC4F-762F11BAF637}.Release|Any
CPU.ActiveCfg = Release|Any CPU
{9DC965DB-37BE-410B-AC4F-762F11BAF637}.Release|Any CPU.Build.0
= Release|Any CPU
+ {FACEAE0F-B8C5-4B34-B95F-90419A7DDC3B}.Debug|Any CPU.ActiveCfg
= Debug|Any CPU
+ {FACEAE0F-B8C5-4B34-B95F-90419A7DDC3B}.Debug|Any CPU.Build.0 =
Debug|Any CPU
+ {FACEAE0F-B8C5-4B34-B95F-90419A7DDC3B}.Release|Any
CPU.ActiveCfg = Release|Any CPU
+ {FACEAE0F-B8C5-4B34-B95F-90419A7DDC3B}.Release|Any CPU.Build.0
= Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches