0

I've built a test class as follows.

[TestFixture]
public class UnitTests
{
  [TestCase(3, 5, 8)]
  [TestCase(3, null, 3)]
  public void UnitTestMethod1(int? a, int? b, int expected)
  {
    int actual = Utilities.SomeSum(a, b);
    Assert.AreEqual(expected, actual);
  }

When I run the tests, I get something higher than zero on my test assembly but precisely zero on the assembly that the tests target. What stupid thing might I have done?! What more information should I provide?

The tested class is super basic and looks as follows.

using System;

public class Utilities
{
  public static int SomeSum(int? a, int? b)
  {
    int? output;
    if (a == null && b == null)
      throw new Exception("Nulls!");

    a = a ?? 0;
    b = b ?? 0;
    output = a + b;
    return (int)output;
  }
}

When I run the stuff on the build server, I get nice results for both but locally in VS13 - strange stuff happens. I got the latest nUnit/dotCover and both work as expected in other projects. Weird...

Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438

1 Answers1

0

Please check that the corresponding PDB files are properly located and make sure that there are no filters that exclude the assembly targeted by your tests.

Maria
  • 526
  • 4
  • 7