I have NUnit test code like this:
[Test]
public void TestHHSInterface()
{
var HHSClient = IOC.container.Resolve<IHHSClient>();
var s = HHSClient.GetTestMessage("Rupert", "Pupkin");
Assert.Greater(s.Value.Length, 0);
}
[Test]
public void TestHHSDeliveryInterface()
{
var Delivery = IOC.container.Resolve<IHHSDelivery>();
var i = Delivery.GetCount();
Assert.Greater(i, 42); // was 17; returns 18
}
[Test]
public void TestHHSDeliveryItemInterface()
{
var Delivery = IOC.container.Resolve<IHHSDeliveryItem>();
var i = Delivery.GetCount();
Assert.Greater(i, 42); // was 19; returns 36
}
The TestHHSDeliveryInterface() test (IHHSDelivery) returns 18, so asserting that it is greater than 42 should make it fail. Similary, TestHHSDeliveryItemInterface() returns 36, so its assertion should also fail. But they all "pass":
Also, I don't understand why only two tests are shown beneath \Integration Test\HHSClientIntegration Tests, when there are three, as shown in the code above.
UPDATE
Pierre-Luc Pineault: You might be right, but even when I reverse it:
Assert.Greater(42, i);
...it still passes.
UPDATE 2
I'm not sure what exactly I need to check to follow up on CodeCaster's suggestion to "Check that you're testing the assemblies containing the code you wrote (Debug/Release, different directory), especially given your remark that you see lest tests in the runner than there are in code."
Following are some things that may be noteworthy; let me know what I'm missing/should look for yet.
The Build property page for the Test project says:
Configuration: Active (Debug)
Output path: bin\Debug
App.config contains this line:
<compilation debug="true" targetFramework="4.5" />
HHS.Web.Tests.nunit contains:
<NUnitProject>
<Settings activeconfig="Default" />
<Config name="Default" binpathtype="Auto">
<assembly path="bin\Debug\HHS.Web.Tests.dll" />
</Config>
</NUnitProject>
(that's the entire contents of HHS.Web.Tests.nunit)
UPDATE 3
In response to some of the comments below (CodeCaster, OnABauer), I don't know if this helps, but the solution has 50 projects (of which I am working on just a few); in "my world," the Startup Projects are three libraries/DLLs, specifically HHS.API, HHS.Web, and HHS.Web.Tests are set to "Start"; all the others are set to "None"
The Debug page of HHS.Web.Tests has "Start external program:" set to "C:\Program Files (x86)\NUnit 2.6.3\bin\nunit.exe" and "Command line arguments:" set to "C:\project\sscs\CStore\Development\Development\HHS.Web.Tests\HHS.Web.Tests.nunit"
UPDATE 4
CodeCaster recommended, "Compare the full path from the test runner with your output path"
How can I determine both things ("the full path from the test runner" and "[my] output path")? Is the path above (C:\project\sscs\CStore\Development\Development\HHS.Web.Tests\HHS.Web.Tests.nunit) the test runner path? Or...???
UPDATE 5
As can be seen in the scream shot above, TestHHSDeliveryInterface shows up in the list of tests (supposedly) being run. So one would think that TestHHSDeliveryItemInterface would show up there, too. After all, all of the places where TestHHSDeliveryInterface appears in the code, TestHHSDeliveryItemInterface does, too:
HHSClientIntegrationtests:
[Test]
public void TestHHSDeliveryInterface()
{
var Delivery = IOC.container.Resolve<IHHSDelivery>();
var i = Delivery.GetCount();
//Assert.Greater(i, 42); // was 17; should return 18
//Assert.Greater(42, i); <= same result (passes)
// Seeing if it's running at all
Assert.Fail(); // <= Test still passes, so something is very fishy here...
}
[Test]
public void TestHHSDeliveryItemInterface()
{
var Delivery = IOC.container.Resolve<IHHSDeliveryItem>();
var i = Delivery.GetCount();
Assert.Greater(i, 42); // was 19; should return 36
}
HHSClientPlayTest:
[Test]
public void TestHHSDeliveryInterface()
{
var HHSDelivInterf = IOC.container.Resolve<IHHSDelivery>();
}
[Test]
public void TestHHSDeliveryItemInterface()
{
var HHSDelivItemInterf = IOC.container.Resolve<IHHSDeliveryItem>();
}
HHSClientUnitTest:
[Test]
public void TestHHSDeliveryInterface()
{
var HHSDelivInterf = IOC.container.Resolve<IHHSDelivery>();
}
[Test]
public void TestHHSDeliveryItemInterface()
{
var HHSDelivItemInterf = IOC.container.Resolve<IHHSDeliveryItem>();
}
And every place in the code where IHHSDelivery exists, there is a corresponding block of code for IHHSDeliveryItem...