using System;
using NUnit.Framework;
using NCover;
namespace NCoverCheckTests.AcceptenceTests.Vb{
[TestFixture]
public class IIfTest
{
[SetUp]
public void SetUp()
{
NCoverCheck.ResetForTests();
}
[Test]
public void test()
{
const string COVER_TRUE_IIF = @"
Public Class A
Public Shared Function B() As Boolean()
Dim x as Boolean = IIf(System.Environment.TickCount > 0, True, False)
Return NCover.NCoverCheck.covered
End Function
End Class";
string instrumentedCode;
TestUtilities.AssertVbCompiles(new string[] { COVER_TRUE_IIF }, "A");
CoveragePoint[] points = new VbInstrumenter( 0, COVER_TRUE_IIF, "").Do(out instrumentedCode, null);
Assert.AreEqual(1, points.Length);
bool[] results = (bool[]) TestUtilities.AssertVbCompiles(new string[] { instrumentedCode }, "A");
Assert.AreEqual(1, results.Length);
TestUtilities.WasHit(points, results, 4);
}
[Test]
public void testNotCovered()
{
const string COVER_TRUE_IIF = @"
Public Class A
Public Shared Function B() As Boolean()
Dim x as Boolean = IIf(System.Environment.TickCount < 0, True, False)
Return NCover.NCoverCheck.covered
End Function
End Class";
string instrumentedCode;
TestUtilities.AssertVbCompiles(new string[] { COVER_TRUE_IIF }, "A");
CoveragePoint[] points = new VbInstrumenter( 0, COVER_TRUE_IIF, "").Do(out instrumentedCode, null);
Assert.AreEqual(1, points.Length);
bool[] results = (bool[]) TestUtilities.AssertVbCompiles(new string[] { instrumentedCode }, "A");
Assert.AreEqual(0, results.Length);
}
}
}
|