mit hyphen

This commit is contained in:
2013-06-25 22:53:41 +00:00
parent 8896edc368
commit 318d93e6c1
424 changed files with 161843 additions and 2 deletions
@@ -0,0 +1,106 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Native.CLISTMENUITEM and is intended
///to contain all Virtuoso.Miranda.Plugins.Native.CLISTMENUITEM Unit Tests
///</summary>
[TestClass(),
MenuItemDeclaration("l", null, Tag = "A", HasIcon = true, UseEmbeddedIcon = true),
MenuItemDeclaration("l", null, Tag = "B", HasIcon = true, UseEmbeddedIcon = true, IconID = "NotHere.ico"),
MenuItemDeclaration("l", null, Tag = "C", HasIcon = true, UseEmbeddedIcon = true, IconID = "Virtuoso.Miranda.Plugins.UnitTests.Here.ico")]
public class CLISTMENUITEMTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for CLISTMENUITEM (MenuItemDeclarationAttribute)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
new MenuItemDeclarationAttribute(null, null);
}
/// <summary>
///A test for CLISTMENUITEM (MenuItemDeclarationAttribute)
///</summary>
[TestMethod()]
public void ConstructorTest2()
{
MenuItemDeclarationAttribute[] attribs = (MenuItemDeclarationAttribute[])this.GetType().GetCustomAttributes(typeof(MenuItemDeclarationAttribute), false);
foreach (MenuItemDeclarationAttribute attrib in attribs)
{
ValueType native = Virtuoso_Miranda_Plugins_Native_CLISTMENUITEMAccessor.CreatePrivate(new FooPlugin(), attrib);
switch (attrib.Tag)
{
case "A":
case "B":
Assert.AreEqual(IntPtr.Zero, native.GetType().GetField("Icon").GetValue(native));
break;
case "C":
Assert.AreNotEqual(IntPtr.Zero, native.GetType().GetField("Icon").GetValue(native));
break;
}
}
}
}
}
@@ -0,0 +1,94 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.ContactInfo and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.ContactInfo Unit Tests
///</summary>
[TestClass()]
public class ContactInfoTest
{
private ContactInfo TestInstance;
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
[TestInitialize]
public void TestInitialize()
{
this.TestInstance = Virtuoso_Miranda_Plugins_Infrastructure_ContactInfoAccessor.CreatePrivate();
}
/// <summary>
///A test for CallContactService (string, UIntPtr, IntPtr)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void CallContactServiceTest()
{
this.TestInstance.CallContactService(null, UIntPtr.Zero, IntPtr.Zero);
}
/// <summary>
///A test for SendMessage (string)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void SendMessageTest()
{
this.TestInstance.SendMessage(null);
}
}
}
@@ -0,0 +1,80 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.DatabaseEventInfo and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.DatabaseEventInfo Unit Tests
///</summary>
[TestClass()]
public class DatabaseEventInfoTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for DatabaseEventInfo (IntPtr)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
DatabaseEventInfo.Create(IntPtr.Zero);
}
}
}
@@ -0,0 +1,80 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.EventHookAttribute and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.EventHookAttribute Unit Tests
///</summary>
[TestClass()]
public class EventHookAttributeTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for EventHookAttribute (string)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
new EventHookAttribute(null);
}
}
}
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
class FooPlugin : MirandaPlugin
{
public override string Author
{
get { throw new Exception("The method or operation is not implemented."); }
}
public override string Description
{
get { throw new Exception("The method or operation is not implemented."); }
}
public override bool HasOptions
{
get { throw new Exception("The method or operation is not implemented."); }
}
public override Uri HomePage
{
get { throw new Exception("The method or operation is not implemented."); }
}
public override string Name
{
get { throw new Exception("The method or operation is not implemented."); }
}
public override Version Version
{
get { throw new Exception("The method or operation is not implemented."); }
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,116 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.HookDescriptor and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.HookDescriptor Unit Tests
///</summary>
[TestClass()]
public class HookDescriptorTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for HookDescriptor (string, Callback, HookType)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate(null, null, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.Undefined);
}
/// <summary>
///A test for HookDescriptor (string, Callback, HookType)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest2()
{
Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("foo", null, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.Undefined);
}
/// <summary>
///A test for Equals (object)
///</summary>
[TestMethod()]
public void EqualsTest()
{
Callback callback1 = delegate { return 0; };
Callback callback2 = delegate { return 1; };
object desc1 = Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("a", callback1, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.EventHook);
object desc2 = Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("a", callback1, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.EventHook);
object desc3 = Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("a", callback2, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.EventHook);
object desc4 = Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("b", callback1, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.EventHook);
object desc5 = Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("a", callback1, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.ServiceFunction);
object desc6 = Virtuoso_Miranda_Plugins_Infrastructure_HookDescriptorAccessor.CreatePrivate("b", callback2, Virtuoso_Miranda_Plugins_Infrastructure_HookTypeAccessor.ServiceFunction);
Assert.AreEqual<bool>(true, desc1.Equals(desc2), "HookDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, desc1.Equals(desc3), "HookDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, desc1.Equals(desc4), "HookDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, desc1.Equals(desc5), "HookDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, desc1.Equals(desc6), "HookDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, desc1.Equals(null), "HookDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, desc1.Equals(new object()), "HookDescriptor.Equals returned wrong result.");
}
}
}
@@ -0,0 +1,181 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Native;
using System.Diagnostics;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Native.InteropBufferPool and is intended
///to contain all Virtuoso.Miranda.Plugins.Native.InteropBufferPool Unit Tests
///</summary>
[TestClass()]
public class InteropBufferPoolTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
[TestInitialize]
public void TestInitializer()
{
InteropBufferPool_Accessor.Refresh();
}
/// <summary>
///A test for AcquireBuffer (int)
///</summary>
[TestMethod()]
public void AcquireBufferTest()
{
InteropBuffer buffer = null, buffer1 = null;
try
{
int prev = InteropBufferPool_Accessor.NextAvailableBufferIndex;
buffer = InteropBufferPool.AcquireBuffer();
Assert.AreEqual<int>(prev + 1, InteropBufferPool_Accessor.NextAvailableBufferIndex);
buffer1 = InteropBufferPool.AcquireBuffer(InteropBufferPool_Accessor.maximumAvailableBufferSize + 1);
Assert.IsTrue(Array.IndexOf<InteropBuffer>(InteropBufferPool_Accessor.Buffers, buffer1) == -1, "Acquired buffer is probably undersized.");
try
{
InteropBufferPool.AcquireBuffer(0);
Assert.Fail("Negative buffer size accepted.");
}
catch { }
}
finally
{
InteropBufferPool.ReleaseBuffer(buffer);
InteropBufferPool.ReleaseBuffer(buffer1);
}
}
[TestMethod()]
public void AcquireReleaseExpandedBufferTest()
{
InteropBuffer buffer = null, buffer1 = null, buffer2 = null;
int expandedSize = InteropBufferPool_Accessor.maximumAvailableBufferSize + 1;
try
{
buffer = buffer1 = InteropBufferPool.AcquireBuffer(expandedSize);
Assert.IsTrue(Array.IndexOf<InteropBuffer>(InteropBufferPool_Accessor.Buffers, buffer) == -1, "Acquired buffer is probably undersized.");
InteropBufferPool.ReleaseBuffer(buffer);
Assert.IsTrue(Array.IndexOf<InteropBuffer>(InteropBufferPool_Accessor.Buffers, buffer1) != -1, "Expanded buffer not assimilated.");
buffer = InteropBufferPool.AcquireBuffer(expandedSize);
Assert.IsTrue(buffer == buffer1, "Assimilated expanded buffer not used.");
Assert.IsTrue(buffer.Size >= expandedSize, "Undersized buffer acquired.");
InteropBufferPool.ReleaseBuffer(buffer);
buffer = InteropBufferPool.AcquireBuffer(expandedSize);
buffer1 = InteropBufferPool.AcquireBuffer(expandedSize);
Assert.IsTrue(buffer != buffer1, "Reserved buffer acquired.");
buffer2 = InteropBufferPool.AcquireBuffer(expandedSize);
Assert.IsTrue(buffer2 != buffer && buffer2 != buffer1, "Reserved buffer acquired.");
}
finally
{
InteropBufferPool.ReleaseBuffer(buffer);
InteropBufferPool.ReleaseBuffer(buffer1);
InteropBufferPool.ReleaseBuffer(buffer2);
}
}
/// <summary>
///A test for ReleaseBuffer (InteropBuffer)
///</summary>
[TestMethod()]
public void ReleaseBufferTest()
{
int prev = InteropBufferPool_Accessor.NextAvailableBufferIndex;
InteropBuffer buffer = InteropBufferPool.AcquireBuffer();
InteropBuffer buffer1 = buffer;
try
{
buffer.Lock();
InteropBufferPool.ReleaseBuffer(buffer);
Assert.Fail("InteropBufferPool::ReleaseBuffer accepts locked buffers.");
}
catch { }
finally
{
buffer.Unlock();
InteropBufferPool.ReleaseBuffer(buffer);
}
try
{
InteropBufferPool.ReleaseBuffer(buffer1);
Assert.Fail("InteropBufferPool::ReleaseBuffer accepts already released buffers.");
}
catch { }
Assert.AreEqual<int>(prev, InteropBufferPool_Accessor.NextAvailableBufferIndex);
try
{
IntPtr ptr = buffer.IntPtr;
Assert.Fail("InteropBufferPool::ReleaseBuffer does not dispose released buffers.");
}
catch { }
}
}
}
@@ -0,0 +1,257 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Native;
using System.Threading;
using System.Runtime.InteropServices;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Native.InteropBuffer and is intended
///to contain all Virtuoso.Miranda.Plugins.Native.InteropBuffer Unit Tests
///</summary>
[TestClass()]
public class InteropBufferTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Equals (object)
///</summary>
[TestMethod()]
public void EqualsTest()
{
InteropBuffer_Accessor target;
InteropBuffer_Accessor obj;
bool expected;
bool actual;
target = new InteropBuffer_Accessor(1);
obj = null;
expected = false;
actual = target.Equals(obj);
Assert.AreEqual(expected, actual, "Virtuoso.Miranda.Plugins.Native.InteropBuffer.Equals did not return the expected value.");
obj = new InteropBuffer_Accessor(1);
expected = false;
actual = target.Equals(obj);
obj.Lock();
((IDisposable)obj).Dispose();
obj.Unlock();
Assert.AreEqual(expected, actual, "Virtuoso.Miranda.Plugins.Native.InteropBuffer.Equals did not return the expected value.");
obj = target;
expected = true;
actual = target.Equals(obj);
target.Lock();
((IDisposable)target).Dispose();
target.Unlock();
Assert.AreEqual(expected, actual, "Virtuoso.Miranda.Plugins.Native.InteropBuffer.Equals did not return the expected value.");
}
/// <summary>
///A test for IntPtr
///</summary>
[TestMethod()]
public void IntPtrTest()
{
InteropBuffer_Accessor target = new InteropBuffer_Accessor(1);
target.Lock();
IntPtr ptr = target.IntPtr;
target.Unlock();
try
{
ptr = target.IntPtr;
Assert.Fail("InteropBuffer::IntPtr succeded without locking.");
}
catch { }
try
{
target.Lock();
((IDisposable)target).Dispose();
ptr = target.IntPtr;
target.Unlock();
Assert.Fail("InteropBuffer::IntPtr succeded after disposal.");
}
catch { }
}
/// <summary>
///A test for Lock ()
///</summary>
[TestMethod()]
public void LockTest()
{
InteropBuffer_Accessor target = new InteropBuffer_Accessor(1);
try
{
target.Lock();
Thread t = new Thread(new ThreadStart(delegate { target.Lock(); }));
t.Start();
Thread.Sleep(250);
Assert.IsFalse(t.Join(1000), "InteropBuffer::Lock does not block other threads.");
Assert.IsTrue(target.Locked, "InteropBuffer::Lock did not set the lock owner.");
}
finally
{
((IDisposable)target).Dispose();
target.Unlock();
}
}
/// <summary>
///A test for Locked
///</summary>
[TestMethod()]
public void LockedTest()
{
InteropBuffer_Accessor target = new InteropBuffer_Accessor(1);
Assert.IsFalse(target.Locked, "InteropBuffer::Locked returned wrong result.");
target.Lock();
Assert.IsTrue(target.Locked, "InteropBuffer::Locked returned wrong result.");
target.Unlock();
}
/// <summary>
///A test for Unlock ()
///</summary>
[TestMethod()]
public void UnlockTest()
{
InteropBuffer_Accessor target = new InteropBuffer_Accessor(1);
try
{
target.Unlock();
Assert.Fail("InteropBuffer::Unlock allows to unlock non-locked buffers.");
}
catch { }
target.Lock();
target.Unlock();
Assert.IsFalse(target.Locked, "InteropBuffer::Unlock does not update the Locked property.");
Thread t = new Thread(new ParameterizedThreadStart(delegate(object obj)
{
target.Lock();
}));
t.Start();
t.Join();
try
{
target.Unlock();
Assert.Fail("InteropBuffer::Unlock allows an unlock from a different thread.");
}
catch { }
finally
{
target.Dispose(true);
}
}
/// <summary>
///A test for Zero ()
///</summary>
[TestMethod()]
public void ZeroTest()
{
InteropBuffer_Accessor target = new InteropBuffer_Accessor(1);
try
{
target.Zero();
Assert.Fail("InteropBuffer::Zero allows unlocked use.");
}
catch { }
target.Lock();
Marshal.WriteByte(target.IntPtr, 0xaf);
target.Zero();
try
{
Assert.AreEqual<byte>(0, Marshal.ReadByte(target.IntPtr));
}
finally
{
((IDisposable)target).Dispose();
target.Unlock();
}
}
/// <summary>
///A test for InteropBuffer (int)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentOutOfRangeException))]
public void ConstructorTest()
{
int capacity = 0;
InteropBuffer_Accessor target = new InteropBuffer_Accessor(capacity);
}
}
}
@@ -0,0 +1,79 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.MenuItemDeclarationAttribute and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.MenuItemDeclarationAttribute Unit Tests
///</summary>
[TestClass()]
public class MenuItemDeclarationAttributeTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for MenuItemDeclarationAttribute (string, string, Type)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest1()
{
new MenuItemDeclarationAttribute(null, "abc");
}
}
}
@@ -0,0 +1,93 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins;
using Virtuoso.Miranda.Plugins.Infrastructure;
using Virtuoso.Miranda.Plugins.Collections;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.MenuItemDeclarationCollection and is intended
///to contain all Virtuoso.Miranda.Plugins.MenuItemDeclarationCollection Unit Tests
///</summary>
[TestClass()]
public class MenuItemDeclarationReadOnlyCollectionTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for FindByTag (string)
///</summary>
[TestMethod()]
public void FindTest()
{
string tag = "tag";
MenuItemDeclarationCollection list = new MenuItemDeclarationCollection();
MenuItemDeclarationAttribute attrib = new MenuItemDeclarationAttribute("a", "b");
attrib.Tag = tag;
list.Add(attrib);
MenuItemDeclarationReadOnlyCollection target = new MenuItemDeclarationReadOnlyCollection(list);
MenuItemDeclarationAttribute expected = attrib;
MenuItemDeclarationAttribute actual = target.Find(tag);
Assert.AreEqual(expected, actual, "FindByTag did not return the expected value.");
Assert.AreEqual(null, target.Find("foo"), "FindByTag return wrong result.");
}
}
}
@@ -0,0 +1,86 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
using Virtuoso.Miranda.Plugins;
using Virtuoso.Miranda.Plugins.Native;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.PluginContext and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.PluginContext Unit Tests
///</summary>
[TestClass()]
public class MirandaContextTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Current
///</summary>
[TestMethod(), ExpectedException(typeof(InvalidOperationException))]
public void CurrentTest()
{
MirandaContext.Current.ToString();
}
[TestMethod, ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
Virtuoso_Miranda_Plugins_Infrastructure_MirandaContextAccessor.InitializeCurrent(null, null);
}
}
}
@@ -0,0 +1,81 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.NetworkProtocol and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.NetworkProtocol Unit Tests
///</summary>
[TestClass()]
public class NetworkProtocolTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for NetworkProtocol (PROTOCOLDESCRIPTOR)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentException))]
public void ConstructorTest()
{
Virtuoso_Miranda_Plugins_Native_PROTOCOLDESCRIPTORAccessor d = new Virtuoso_Miranda_Plugins_Native_PROTOCOLDESCRIPTORAccessor(null);
Virtuoso_Miranda_Plugins_Infrastructure_NetworkProtocolAccessor.CreatePrivate(ref d);
}
}
}
@@ -0,0 +1,122 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins;
using Virtuoso.Miranda.Plugins.Collections;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.PluginDescriptorReadOnlyCollection and is intended
///to contain all Virtuoso.Miranda.Plugins.PluginDescriptorReadOnlyCollection Unit Tests
///</summary>
[TestClass()]
public class PluginDescriptorReadOnlyCollectionTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for ContainsDescriptorOf (MirandaPlugin)
///</summary>
[TestMethod()]
public void ContainsDescriptorOfTest()
{
PluginDescriptorCollection list = new PluginDescriptorCollection();
MirandaPlugin plugin = Virtuoso_Miranda_Plugins_MirandaPlugin_EmptyPluginAccessor.CreatePrivate();
PluginDescriptor descriptor = Virtuoso_Miranda_Plugins_PluginDescriptorAccessor.CreatePrivate(plugin);
list.Add(descriptor);
PluginDescriptorReadOnlyCollection target = new PluginDescriptorReadOnlyCollection(list);
bool expected = true;
bool actual = target.ContainsDescriptorOf(plugin);
Assert.AreEqual<bool>(expected, actual, "Virtuoso.Miranda.Plugins.PluginDescriptorReadOnlyCollection.ContainsDescriptorOf did not return the expected value.");
expected = true;
actual = target.ContainsDescriptorOf(plugin.GetType());
Assert.AreEqual<bool>(expected, actual, "Virtuoso.Miranda.Plugins.PluginDescriptorReadOnlyCollection.ContainsDescriptorOf did not return the expected value.");
Assert.AreEqual<bool>(false, target.ContainsDescriptorOf(Virtuoso_Miranda_Plugins_MirandaPlugin_EmptyPluginAccessor.CreatePrivate()), "False result returned from the ContainsDescriptorOf method.");
Assert.AreEqual<bool>(false, target.ContainsDescriptorOf(typeof(string)), "False result returned from the ContainsDescriptorOf method.");
}
/// <summary>
///A test for FindDescriptorOf (MirandaPlugin)
///</summary>
[TestMethod()]
public void FindDescriptorTest()
{
PluginDescriptorCollection list = new PluginDescriptorCollection();
MirandaPlugin plugin = Virtuoso_Miranda_Plugins_MirandaPlugin_EmptyPluginAccessor.CreatePrivate();
PluginDescriptor descriptor = Virtuoso_Miranda_Plugins_PluginDescriptorAccessor.CreatePrivate(plugin);
list.Add(descriptor);
PluginDescriptorReadOnlyCollection target = new PluginDescriptorReadOnlyCollection(list);
PluginDescriptor expected = descriptor;
PluginDescriptor actual = target.FindDescriptorOf(plugin);
Assert.AreEqual<PluginDescriptor>(expected, actual, "Virtuoso.Miranda.Plugins.PluginDescriptorReadOnlyCollection.FindDescriptorOf did not return the expected value.");
expected = descriptor;
actual = target.FindDescriptorOf(plugin.GetType());
Assert.AreEqual<PluginDescriptor>(expected, actual, "Virtuoso.Miranda.Plugins.PluginDescriptorReadOnlyCollection.FindDescriptorOf did not return the expected value.");
Assert.AreEqual<PluginDescriptor>(null, target.FindDescriptorOf(Virtuoso_Miranda_Plugins_MirandaPlugin_EmptyPluginAccessor.CreatePrivate()), "False result returned from the FindDescriptorOf method.");
Assert.AreEqual<PluginDescriptor>(null, target.FindDescriptorOf(typeof(string)), "False result returned from the FindDescriptorOf method.");
}
}
}
@@ -0,0 +1,100 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins;
using System.Reflection;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.PluginDescriptor and is intended
///to contain all Virtuoso.Miranda.Plugins.PluginDescriptor Unit Tests
///</summary>
[TestClass()]
public class PluginDescriptorTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Equals (object)
///</summary>
[TestMethod(), ExpectedException(typeof(InvalidOperationException))]
public void EqualsTest()
{
MirandaPlugin plugin1 = Virtuoso_Miranda_Plugins_MirandaPlugin_EmptyPluginAccessor.CreatePrivate();
MirandaPlugin plugin2 = Virtuoso_Miranda_Plugins_MirandaPlugin_EmptyPluginAccessor.CreatePrivate();
PluginDescriptor descriptor1 = Virtuoso_Miranda_Plugins_PluginDescriptorAccessor.CreatePrivate(plugin1);
PluginDescriptor descriptor2 = Virtuoso_Miranda_Plugins_PluginDescriptorAccessor.CreatePrivate(plugin2);
Assert.AreEqual<bool>(true, descriptor1.Equals(descriptor2), "PluginDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, descriptor1.Equals(null), "PluginDescriptor.Equals returned wrong result.");
Assert.AreEqual<bool>(false, descriptor1.Equals(new object()), "PluginDescriptor.Equals returned wrong result.");
Virtuoso_Miranda_Plugins_PluginDescriptorAccessor.CreatePrivate(plugin1);
}
/// <summary>
///A test for PluginDescriptor (MirandaPlugin, bool)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
Virtuoso_Miranda_Plugins_PluginDescriptorAccessor.CreatePrivate(null);
}
}
}
@@ -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("Virtuoso.Miranda.Plugins.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Home")]
[assembly: AssemblyProduct("Virtuoso.Miranda.Plugins.UnitTests")]
[assembly: AssemblyCopyright("Copyright © Home 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. 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("83dde3d5-467d-4a60-a1b3-174efc22bdea")]
// 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")]
@@ -0,0 +1,80 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Infrastructure;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Infrastructure.ServiceFunctionAttribute and is intended
///to contain all Virtuoso.Miranda.Plugins.Infrastructure.ServiceFunctionAttribute Unit Tests
///</summary>
[TestClass()]
public class ServiceFunctionAttributeTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for ServiceFunctionAttribute (string)
///</summary>
[TestMethod(), ExpectedException(typeof(ArgumentNullException))]
public void ConstructorTest()
{
new ServiceFunctionAttribute(null);
}
}
}
@@ -0,0 +1,2 @@
Hyphen.dll
Desktop
+88
View File
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{88ECE450-D3F9-40BF-A702-272BF1D9000B}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Virtuoso.Miranda.Plugins.UnitTests</RootNamespace>
<AssemblyName>Virtuoso.Miranda.Plugins.UnitTests</AssemblyName>
<WarningLevel>4</WarningLevel>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Virtuoso.Hyphen.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>0</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>.\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InteropBufferPoolTest.cs" />
<Compile Include="InteropBufferTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Shadow Include="Test References\Hyphen.accessor" />
<None Include="Virtuoso.Hyphen.snk" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Virtuoso.Hyphen\Virtuoso.Hyphen.vcproj">
<Project>{17AC97C6-92C5-4BC5-BBB4-9DCC2198E36C}</Project>
<Name>Hyphen</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
@@ -0,0 +1,17 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<PublishUrlHistory>
</PublishUrlHistory>
<InstallUrlHistory>
</InstallUrlHistory>
<SupportUrlHistory>
</SupportUrlHistory>
<UpdateUrlHistory>
</UpdateUrlHistory>
<BootstrapperUrlHistory>
</BootstrapperUrlHistory>
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
@@ -0,0 +1,115 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Native;
using System.Runtime.InteropServices;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Native.UnmanagedStringHandle and is intended
///to contain all Virtuoso.Miranda.Plugins.Native.UnmanagedStringHandle Unit Tests
///</summary>
[TestClass()]
public class UnmanagedStringHandleTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Free ()
///</summary>
[TestMethod()]
public void FreeTest()
{
UnmanagedStringHandle handle = new UnmanagedStringHandle("foo");
handle.Free();
handle = UnmanagedStringHandle.Empty;
handle.Free();
}
/// <summary>
///A test for UnmanagedStringHandle (string, StringMarshalKind)
///</summary>
[TestMethod()]
public void ConstructorTest()
{
const string str = "foo";
UnmanagedStringHandle handle = UnmanagedStringHandle.Empty;
try
{
handle = new UnmanagedStringHandle(str);
Assert.AreEqual<string>(str, Marshal.PtrToStringAnsi(handle.IntPtr));
}
finally
{
handle.Free();
}
try
{
handle = new UnmanagedStringHandle(str, StringEncoding.Unicode);
Assert.AreEqual<string>(str, Marshal.PtrToStringUni(handle.IntPtr));
}
finally
{
handle.Free();
}
}
}
}
@@ -0,0 +1,178 @@
// The following code was generated by Microsoft Visual Studio 2005.
// The test owner should check each test for validity.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
using Virtuoso.Miranda.Plugins.Native;
using System.Runtime.InteropServices;
namespace Virtuoso.Miranda.Plugins.UnitTests
{
/// <summary>
///This is a test class for Virtuoso.Miranda.Plugins.Native.UnmanagedStructHandle&lt;T&gt; and is intended
///to contain all Virtuoso.Miranda.Plugins.Native.UnmanagedStructHandle&lt;T&gt; Unit Tests
///</summary>
[TestClass()]
public class UnmanagedStructHandleTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
private const int TestDataValue = 100;
private int TestData;
private UnmanagedStructHandle<int> TestHandle;
[TestInitialize]
public void TestInitialize()
{
this.TestData = TestDataValue;
this.TestHandle = new UnmanagedStructHandle<int>(ref this.TestData);
}
[TestCleanup]
public void TestCleanup()
{
this.TestHandle.Free();
}
/// <summary>
///A test for Free ()
///</summary>
[TestMethod()]
public void FreeTest()
{
this.TestHandle.Free();
Assert.AreEqual<IntPtr>(IntPtr.Zero, this.TestHandle.IntPtr, "Free method did not zeroed the memory handle.");
this.TestHandle = UnmanagedStructHandle<int>.Empty;
this.TestHandle.Free();
IntPtr ptr = Marshal.AllocHGlobal(1);
Marshal.StructureToPtr(0xac, ptr, false);
this.TestHandle = new UnmanagedStructHandle<int>(ref this.TestData, ptr);
this.TestHandle.Free();
Assert.AreNotEqual<byte>(0xac, Marshal.ReadByte(ptr), "Free did not released the single-pressure.");
ptr = Marshal.AllocHGlobal(1);
Marshal.StructureToPtr(0xac, ptr, false);
this.TestHandle = new UnmanagedStructHandle<int>(ref this.TestData, new IntPtr[] { ptr });
this.TestHandle.Free();
Assert.AreNotEqual<byte>(0xac, Marshal.ReadByte(ptr), "Free did not released the pressure.");
}
/// <summary>
///A test for implicit operator (UnmanagedStructHandle&lt;T&gt;)
///</summary>
[TestMethod()]
public void ConversionTest()
{
IntPtr intPtr = this.TestHandle;
Assert.AreEqual<IntPtr>(this.TestHandle.IntPtr, intPtr, "Implicit conversion to IntPtr failed.");
}
/// <summary>
///A test for implicit operator (UnmanagedStructHandle&lt;T&gt;)
///</summary>
[TestMethod()]
public void ConversionTest1()
{
UIntPtr uintPtr = this.TestHandle;
Assert.AreEqual<UIntPtr>(new UIntPtr((ulong)this.TestHandle.IntPtr.ToInt64()), uintPtr, "Implicit conversion to UIntPtr failed.");
}
[TestMethod]
public void IntPtrTest()
{
this.TestHandle.Free();
Assert.AreEqual<IntPtr>(IntPtr.Zero, this.TestHandle.IntPtr);
}
/// <summary>
///A test for MarshalBack (out T)
///</summary>
[TestMethod()]
public void MarshalBackTest()
{
// Value type test
int newInt = -100;
Marshal.StructureToPtr(newInt, this.TestHandle.IntPtr, false);
int currentInt;
this.TestHandle.MarshalBack(out currentInt);
Assert.AreEqual<int>(newInt, currentInt, "MarshalBack method did not marshalled data back correctly.");
}
[TestMethod]
public void CtorTest()
{
int i = 100;
this.TestHandle = new UnmanagedStructHandle<int>(ref i, MarshalKind.Copy);
Marshal.WriteInt32(this.TestHandle, -100);
this.TestHandle.MarshalBack(out i);
Assert.AreEqual<int>(-100, i, "Copy method does not work properly.");
this.TestHandle.Free();
i = 100;
this.TestHandle = new UnmanagedStructHandle<int>(ref i, MarshalKind.PinBlittable);
Marshal.WriteInt32(this.TestHandle, -100);
this.TestHandle.MarshalBack(out i);
Assert.AreEqual<int>(-100, i, "PinBlittable method does not work properly.");
this.TestHandle.Free();
}
}
}
Binary file not shown.