Skip to content
Permalink
Browse files

Modified to use InspectionTestsBase

  • Loading branch information
BZngr committed Oct 10, 2019
1 parent cf9aefe commit d338d441bb7405765df72f6fa6e2f8197255ca41
Showing with 8 additions and 18 deletions.
  1. +8 −18 RubberduckTests/Inspections/EmptyWhileWendBlockInspectionTests.cs
@@ -1,22 +1,21 @@
using System.Linq;
using System.Threading;
using NUnit.Framework;
using RubberduckTests.Mocks;
using Rubberduck.Inspections.Concrete;
using Rubberduck.Parsing.Inspections.Abstract;
using Rubberduck.Parsing.VBA;

namespace RubberduckTests.Inspections
{
[TestFixture]
public class EmptyWhileWendBlockInspectionTests
public class EmptyWhileWendBlockInspectionTests : InspectionTestsBase
{
[Test]
[Category("Inspections")]
public void EmptyWhileWendBlock_InspectionName()
{
const string expectedName = nameof(EmptyWhileWendBlockInspection);
var inspection = new EmptyWhileWendBlockInspection(null);

Assert.AreEqual(expectedName, inspection.Name);
Assert.AreEqual(nameof(EmptyWhileWendBlockInspection), inspection.Name);
}

[Test]
@@ -34,7 +33,7 @@ public void EmptyWhileWendBlock_DoesNotFiresOnImplementedLoopBlocks()
LTotal = LTotal + 1
Wend
End Sub";
CheckActualEmptyBlockCountEqualsExpected(inputCode, 0);
Assert.AreEqual(0, InspectionResultsForStandardModule(inputCode).Count());
}

[Test]
@@ -52,21 +51,12 @@ public void EmptyWhileWendBlock_FiresOnEmptyLoopBlocks()
'LTotal = LTotal + 1
Wend
End Sub";
CheckActualEmptyBlockCountEqualsExpected(inputCode, 1);
Assert.AreEqual(1, InspectionResultsForStandardModule(inputCode).Count());
}

private void CheckActualEmptyBlockCountEqualsExpected(string inputCode, int expectedCount)
protected override IInspection InspectionUnderTest(RubberduckParserState state)
{
var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _);
using (var state = MockParser.CreateAndParse(vbe.Object))
{

var inspection = new EmptyWhileWendBlockInspection(state);
var inspector = InspectionsHelper.GetInspector(inspection);
var actualResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result;

Assert.AreEqual(expectedCount, actualResults.Count());
}
return new EmptyWhileWendBlockInspection(state);
}
}
}

0 comments on commit d338d44

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