using System;
using NUnit.Framework;
using NCover;
namespace NCoverCheckTests.AcceptenceTests.Vb{
[TestFixture]
public class SelectCaseTest
{
[SetUp]
public void SetUp()
{
NCoverCheck.ResetForTests();
}
[Test]
public void test()
{
const string CODE = @"
Public Class A
Public Shared Function B() As Boolean()
Select Case True
Case True '5
Case Else
End Select
Return NCover.NCoverCheck.covered
End Function
End Class";
string instrumentedCode;
TestUtilities.AssertVbCompiles(new string[] { CODE }, "A");
CoveragePoint[] points = new VbInstrumenter( 0, CODE, "").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, 5);
}
[Test]
public void testFalse()
{
const string CODE = @"
Public Class A
Public Shared Function B() As Boolean()
Select Case True
Case False '5
Case Else
End Select
Return NCover.NCoverCheck.covered
End Function
End Class";
string instrumentedCode;
TestUtilities.AssertVbCompiles(new string[] { CODE }, "A");
CoveragePoint[] points = new VbInstrumenter( 0, CODE, "").Do(out instrumentedCode, null);
Assert.AreEqual(1, points.Length);
bool[] results = (bool[]) TestUtilities.AssertVbCompiles(new string[] { instrumentedCode }, "A");
Assert.AreEqual(0, results.Length);
}
}
}
|