Skip to content
Permalink
Browse files

Unignore tests and provide a COM objects to support tests.

  • Loading branch information
bclothier committed Oct 11, 2019
1 parent db52bdb commit 67e205e5cd2f78afa2dfbd2145a89f1f7607eee6
Showing with 13 additions and 16 deletions.
  1. +13 −16 RubberduckTests/UnitTesting/AssertTests.cs
@@ -1,3 +1,4 @@
using System;
using NUnit.Framework;
using Rubberduck.UnitTesting;

@@ -68,11 +69,10 @@ public void IsFalseFailsWithTrueExpression()

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreSameShouldSucceedWithSameReferences()
{
var assert = new AssertClass();
var obj1 = new object();
var obj1 = GetComObject();
var obj2 = obj1;
assert.AreSame(obj1, obj2);

@@ -81,12 +81,11 @@ public void AreSameShouldSucceedWithSameReferences()

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreSameShouldFailWithDifferentReferences()
{
var assert = new AssertClass();
var obj1 = new object();
var obj2 = new object();
var obj1 = GetComObject();
var obj2 = GetComObject();
assert.AreSame(obj1, obj2);

Assert.AreEqual(TestOutcome.Failed, _args.Outcome);
@@ -104,46 +103,42 @@ public void AreSameShouldSucceedWithTwoNullReferences()

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreSameShouldFailWithActualNullReference()
{
var assert = new AssertClass();
assert.AreSame(new object(), null);
assert.AreSame(GetComObject(), null);

Assert.AreEqual(TestOutcome.Failed, _args.Outcome);
}

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreSameShouldFailWithExpectedNullReference()
{
var assert = new AssertClass();
assert.AreSame(null, new object());
assert.AreSame(null, GetComObject());

Assert.AreEqual(TestOutcome.Failed, _args.Outcome);
}

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreNotSameShouldSucceedWithDifferentReferences()
{
var assert = new AssertClass();
var obj1 = new object();
var obj2 = new object();
var obj1 = GetComObject();
var obj2 = GetComObject();
assert.AreNotSame(obj1, obj2);

Assert.AreEqual(TestOutcome.Succeeded, _args.Outcome);
}

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreNotSameShouldSuccedWithOneNullReference()
{
var assert = new AssertClass();
assert.AreNotSame(new object(), null);
assert.AreNotSame(GetComObject(), null);

Assert.AreEqual(TestOutcome.Succeeded, _args.Outcome);
}
@@ -160,11 +155,10 @@ public void AreNotSameShouldFailWithBothNullReferences()

[Category("Unit Testing")]
[Test]
[Ignore("Would require passing COM objects for proper verification")]
public void AreNotSameShouldFailWithSameReferences()
{
var assert = new AssertClass();
var obj1 = new object();
var obj1 = GetComObject();
var obj2 = obj1;
assert.AreNotSame(obj1, obj2);

@@ -355,5 +349,8 @@ public void OnAssertInconclusive_ReturnsResultInconclusive()

Assert.AreEqual(TestOutcome.Inconclusive, _args.Outcome);
}

private static Type GetComObjectType() => Type.GetTypeFromProgID("Scripting.FileSystemObject");
private object GetComObject() => Activator.CreateInstance(GetComObjectType());
}
}

0 comments on commit 67e205e

Please sign in to comment.
You can’t perform that action at this time.