public void Selection_Contains_LastToken() { const string inputCode = @" Option Explicit Public Sub foo(Bar As Long, Baz As Long) If Bar > Baz Then Debug.Print ""Yeah!"" Else Debug.Print ""Boo!"" End If If Baz > Bar Then Debug.Print ""Boo!"" Else Debug.Print ""Yeah!"" End If End Sub : 'Lame comment! "; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); var pane = component.CodeModule.CodePane; using (var state = MockParser.CreateAndParse(vbe.Object)) { var tree = state.GetParseTree(new QualifiedModuleName(component)); var visitor = new IfStmtContextElementCollectorVisitor(); var contexts = visitor.Visit(tree); var token = contexts.ElementAt(1).Stop; var selection = new Selection(12, 1, 16, 7); Assert.IsTrue(selection.Contains(token)); // last token in second If block Assert.IsFalse(selection.Contains(contexts.ElementAt(0))); // first If block Assert.IsTrue(selection.Contains(contexts.ElementAt(1))); // second If block } }
public void EmptyIfBlock_QuickFixRemovesElseIf_HasComment() { const string inputCode = @"Sub Foo() If True Then Dim d d = 0 ElseIf False Then ' Im a comment Else Dim b b = 0 End If End Sub"; const string expectedCode = @"Sub Foo() If True Then Dim d d = 0 Else Dim b b = 0 End If End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new EmptyIfBlockInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; new RemoveEmptyIfBlockQuickFix(state).Fix(inspectionResults.First()); Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); } }
public void IntroduceFieldRefactoring_PassInTarget_Nonvariable() { //Input const string inputCode = @"Private Sub Foo() Dim bar As Boolean End Sub"; IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component); using (var state = MockParser.CreateAndParse(vbe.Object)) { var messageBox = new Mock <IMessageBox>(); messageBox.Setup(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MessageBoxButtons>(), It.IsAny <MessageBoxIcon>())) .Returns(DialogResult.OK); var refactoring = new IntroduceFieldRefactoring(vbe.Object, state, messageBox.Object); try { refactoring.Refactor(state.AllUserDeclarations.First(d => d.DeclarationType != DeclarationType.Variable)); } catch (ArgumentException e) { messageBox.Verify(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MessageBoxButtons>(), It.IsAny <MessageBoxIcon>()), Times.Once); Assert.AreEqual("target", e.ParamName); var actual = state.GetRewriter(component).GetText(); Assert.AreEqual(inputCode, actual); return; } Assert.Fail(); } }
public void EmptyIfBlock_QuickFixRemovesIf_HasVariable_WithLabel() { const string inputCode = @"Sub Foo() If True Then 5 Dim d a: Dim e 15 b: Dim f Else Dim b b = 0 End If End Sub"; const string expectedRewrite = @"Sub Foo() 5 Dim d a: Dim e 15 b: Dim f If Not True Then Dim b b = 0 End If End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new EmptyConditionBlockInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; new RemoveEmptyConditionBlockQuickFix(state).Fix(inspectionResults.First()); var actualRewrite = state.GetRewriter(component).GetText(); Assert.AreEqual(expectedRewrite, actualRewrite); }
public void FindAllImplementations_SelectedReference_ReturnsCorrectNumber() { const string inputClass = @"Implements IClass1 Public Sub IClass1_Foo() End Sub Public Sub Buzz() IClass1_Foo End Sub"; const string inputInterface = @"Public Sub Foo() End Sub"; var builder = new MockVbeBuilder(); var project = builder.ProjectBuilder("TestProject", ProjectProtection.Unprotected) .AddComponent("Class1", ComponentType.ClassModule, inputClass, new Selection(7, 5, 7, 5)) .AddComponent("Class2", ComponentType.ClassModule, inputClass) .AddComponent("IClass1", ComponentType.ClassModule, inputInterface) .Build(); var vbe = builder.AddProject(project).Build(); vbe.Setup(v => v.ActiveCodePane).Returns(project.Object.VBComponents["Class1"].CodeModule.CodePane); using (var state = MockParser.CreateAndParse(vbe.Object)) { var vm = ArrangeSearchResultsWindowViewModel(); var service = ArrangeFindAllImplementationsService(state, vm); var command = ArrangeFindAllImplementationsCommand(state, vbe, vm, service); command.Execute(null); Assert.AreEqual(2, vm.Tabs[0].SearchResults.Count); } }
public void ObsoleteCallStatement_IgnoreQuickFixWorks() { const string inputCode = @"Sub Foo() Call Goo(1, ""test"") End Sub Sub Goo(arg1 As Integer, arg1 As String) Call Foo End Sub"; const string expectedCode = @"Sub Foo() '@Ignore ObsoleteCallStatement Call Goo(1, ""test"") End Sub Sub Goo(arg1 As Integer, arg1 As String) '@Ignore ObsoleteCallStatement Call Foo End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new ObsoleteCallStatementInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; var fix = new IgnoreOnceQuickFix(state, new[] { inspection }); foreach (var result in inspectionResults) { fix.Fix(result); } Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); }
public void MoveCloserToUsageRefactoring_MultipleVariablesOneStatement_MoveLast() { //Input const string inputCode = @"Private Sub Foo() Dim bar As Integer, _ bat As Boolean, _ bay As Date bar = 4 bay = #1/13/2004# End Sub"; var selection = new Selection(4, 16); //Expectation const string expectedCode = @"Private Sub Foo() Dim bar As Integer, _ bat As Boolean bar = 4 Dim bay As Date bay = #1/13/2004# End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component, selection); using (var state = MockParser.CreateAndParse(vbe.Object)) { var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection); var refactoring = new MoveCloserToUsageRefactoring(vbe.Object, state, null); refactoring.Refactor(qualifiedSelection); var rewriter = state.GetRewriter(component); Assert.AreEqual(expectedCode, rewriter.GetText()); } }
public void ImplementInterface_Function() { //Input const string inputCode1 = @"Public Function Foo() As Integer End Function"; const string inputCode2 = @"Implements Class1"; //Expectation const string expectedCode = @"Implements Class1 Private Function Class1_Foo() As Integer Err.Raise 5 'TODO implement interface member End Function "; var builder = new MockVbeBuilder(); var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected) .AddComponent("Class1", ComponentType.ClassModule, inputCode1) .AddComponent("Class2", ComponentType.ClassModule, inputCode2) .Build(); var vbe = builder.AddProject(project).Build(); var component = project.Object.VBComponents[1]; using (var state = MockParser.CreateAndParse(vbe.Object)) { var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), Selection.Home); var refactoring = new ImplementInterfaceRefactoring(vbe.Object, state, null); refactoring.Refactor(qualifiedSelection); var rewriter = state.GetRewriter(component); Assert.AreEqual(expectedCode, rewriter.GetText()); } }
public void MoveCloserToUsageRefactoring_ReferenceIsNotBeginningOfStatement_PassAsParam_ReferenceIsNotFirstLine() { //Input const string inputCode = @"Private bar As Boolean Private Sub Foo() Baz True, _ True, _ bar End Sub Sub Baz(ByVal bat As Boolean, ByVal bas As Boolean, ByVal bac As Boolean) End Sub"; const string expectedCode = @"Private Sub Foo() Dim bar As Boolean Baz True, _ True, _ bar End Sub Sub Baz(ByVal bat As Boolean, ByVal bas As Boolean, ByVal bac As Boolean) End Sub"; var selection = new Selection(1, 1); IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component, selection); using (var state = MockParser.CreateAndParse(vbe.Object)) { var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection); var refactoring = new MoveCloserToUsageRefactoring(vbe.Object, state, null); refactoring.Refactor(qualifiedSelection); var rewriter = state.GetRewriter(component); Assert.AreEqual(expectedCode, rewriter.GetText()); } }
public void RedundantByRefModifier_ReturnsResult_MultipleInterfaceImplementation() { const string inputCode1 = @"Sub Foo(ByRef arg1 As Integer) End Sub"; const string inputCode2 = @"Implements IClass1 Sub IClass1_Foo(ByRef arg1 As Integer) End Sub"; const string inputCode3 = @"Implements IClass1 Sub IClass1_Foo(ByRef arg1 As Integer) End Sub"; var builder = new MockVbeBuilder(); var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected) .AddComponent("IClass1", ComponentType.ClassModule, inputCode1) .AddComponent("Class1", ComponentType.ClassModule, inputCode2) .AddComponent("Class2", ComponentType.ClassModule, inputCode3) .Build(); var vbe = builder.AddProject(project).Build(); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new RedundantByRefModifierInspection(state) { Severity = CodeInspectionSeverity.Hint }; var inspector = InspectionsHelper.GetInspector(inspection); var inspectionResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; Assert.AreEqual(1, inspectionResults.Count()); } }
public void ObjectVariableNotSet_ForFunctionAssignment_ReturnsResult() { var expectedResultCount = 2; var input = @" Private Function CombineRanges(ByVal source As Range, ByVal toCombine As Range) As Range If source Is Nothing Then CombineRanges = toCombine 'no inspection result (but there should be one!) Else CombineRanges = Union(source, toCombine) 'no inspection result (but there should be one!) End If End Function"; var expectedCode = @" Private Function CombineRanges(ByVal source As Range, ByVal toCombine As Range) As Range If source Is Nothing Then Set CombineRanges = toCombine 'no inspection result (but there should be one!) Else Set CombineRanges = Union(source, toCombine) 'no inspection result (but there should be one!) End If End Function"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out var component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new ObjectVariableNotSetInspection(state); var inspectionResults = inspection.GetInspectionResults().ToList(); Assert.AreEqual(expectedResultCount, inspectionResults.Count); var fix = new UseSetKeywordForObjectAssignmentQuickFix(state); foreach (var result in inspectionResults) { fix.Fix(result); } Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); }
public void WriteOnlyProperty_ReturnsResult_LetAndSet() { const string inputCode = @"Property Let Foo(value) End Property Property Set Foo(value) End Property"; var builder = new MockVbeBuilder(); var project = builder.ProjectBuilder("VBAProject", ProjectProtection.Unprotected) .AddComponent("MyClass", ComponentType.ClassModule, inputCode) .Build(); var vbe = builder.AddProject(project).Build(); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new WriteOnlyPropertyInspection(state); var inspectionResults = inspection.GetInspectionResults(); Assert.AreEqual(2, inspectionResults.Count()); } }
public void ObsoleteTypeHint_QuickFixWorks_Field_SingleTypeHint() { const string inputCode = @"Public Foo!"; const string expectedCode = @"Public Foo As Single"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new ObsoleteTypeHintInspection(state); var inspectionResults = inspection.GetInspectionResults(); var fix = new RemoveTypeHintsQuickFix(state); foreach (var result in inspectionResults) { fix.Fix(result); } Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); }
public void LabelNotUsed_QuickFixWorks() { const string inputCode = @"Sub Foo() label1: End Sub"; const string expectedCode = @"Sub Foo() End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new LineLabelNotUsedInspection(state); new RemoveUnusedDeclarationQuickFix(state).Fix(inspection.GetInspectionResults(CancellationToken.None).First()); var rewriter = state.GetRewriter(component); Assert.AreEqual(expectedCode, rewriter.GetText()); } }
public void UnassignedVariable_WithCommentOnSameLine_DoesNotRemoveComment() { const string inputCode = @"Sub Foo() Dim var1 As String ' Comment End Sub"; const string expectedCode = @"Sub Foo() ' Comment End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new VariableNotUsedInspection(state); new RemoveUnusedDeclarationQuickFix(state).Fix(inspection.GetInspectionResults(CancellationToken.None).First()); var rewriter = state.GetRewriter(component); Assert.AreEqual(expectedCode, rewriter.GetText()); } }
public void UnassignedVariable_IgnoreQuickFixWorks() { const string inputCode = @"Sub Foo() Dim var1 As String End Sub"; const string expectedCode = @"Sub Foo() '@Ignore VariableNotUsed Dim var1 As String End Sub"; IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new VariableNotUsedInspection(state, new Mock <IMessageBox>().Object); inspection.GetInspectionResults().First().QuickFixes.Single(s => s is IgnoreOnceQuickFix).Fix(); Assert.AreEqual(expectedCode, component.CodeModule.Content()); }
public void ExtractInterface_CanExecute_ClassWithMembers_SameNameAsClassWithMembers() { var input = @"Sub foo() End Sub"; var builder = new MockVbeBuilder(); var proj1 = builder.ProjectBuilder("TestProj1", ProjectProtection.Unprotected).AddComponent("Comp1", ComponentType.ClassModule, input, Selection.Home).Build(); var proj2 = builder.ProjectBuilder("TestProj2", ProjectProtection.Unprotected).AddComponent("Comp1", ComponentType.ClassModule, string.Empty).Build(); var vbe = builder .AddProject(proj1) .AddProject(proj2) .Build(); vbe.Setup(s => s.ActiveCodePane).Returns(proj1.Object.VBComponents[0].CodeModule.CodePane); using (var state = MockParser.CreateAndParse(vbe.Object)) { var extractInterfaceCommand = new RefactorExtractInterfaceCommand(vbe.Object, state, null); Assert.IsTrue(extractInterfaceCommand.CanExecute(null)); } }
public void AddsExpectedErrorTest_NullActiveCodePane() { var input = @" Option Explicit Option Private Module '@TestModule Private Assert As Object "; IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out component); vbe.Setup(s => s.ActiveCodePane).Returns((ICodePane)null); var state = MockParser.CreateAndParse(vbe.Object); var addTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe.Object, state); addTestMethodCommand.Execute(null); Assert.AreEqual(input, component.CodeModule.Content()); }
public void ConstantNotUsed_ReturnsResult_UnusedConstant() { const string inputCode = @"Public Sub Foo() Const const1 As Integer = 9 Goo const1 Const const2 As String = ""test"" End Sub Public Sub Goo(ByVal arg1 As Integer) End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new ConstantNotUsedInspection(state); var inspectionResults = inspection.GetInspectionResults(); Assert.AreEqual(1, inspectionResults.Count()); } }
public void WriteOnlyProperty_AddPropertyGetQuickFixWorks_MultipleParams() { const string inputCode = @"Public Property Let Foo(value1, ByVal value2 As Integer, ByRef value3 As Long, value4 As Date, ByVal value5, value6 As String) End Property"; const string expectedCode = @"Public Property Get Foo(ByRef value1 As Variant, ByVal value2 As Integer, ByRef value3 As Long, ByRef value4 As Date, ByVal value5 As Variant) As String End Property Public Property Let Foo(value1, ByVal value2 As Integer, ByRef value3 As Long, value4 As Date, ByVal value5, value6 As String) End Property"; var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out var component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new WriteOnlyPropertyInspection(state); var inspectionResults = inspection.GetInspectionResults(); new WriteOnlyPropertyQuickFix(state).Fix(inspectionResults.First()); Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); }
public void WriteOnlyProperty_AddPropertyGetQuickFixWorks_ExlicitTypesAndAccessibility() { const string inputCode = @"Public Property Let Foo(ByVal value As Integer) End Property"; const string expectedCode = @"Public Property Get Foo() As Integer End Property Public Property Let Foo(ByVal value As Integer) End Property"; var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.ClassModule, out var component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new WriteOnlyPropertyInspection(state); var inspectionResults = inspection.GetInspectionResults(); new WriteOnlyPropertyQuickFix(state).Fix(inspectionResults.First()); Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); }
public void VariableNotUsed_ReturnsResult_MultipleVariables_SomeAssigned() { const string inputCode = @"Sub Foo() Dim var1 as Integer var1 = 8 Dim var2 as String Goo var1 End Sub Sub Goo(ByVal arg1 As Integer) End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new VariableNotUsedInspection(state); var inspectionResults = inspection.GetInspectionResults(); Assert.AreEqual(1, inspectionResults.Count()); }
public void UnassignedVariable_MultipleVariablesOnSingleLine_QuickFixWorks() { const string inputCode = @"Sub Foo() Dim var1 As Integer, var2 As Boolean End Sub"; const string expectedCode = @"Sub Foo() Dim var1 As Integer End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new VariableNotAssignedInspection(state); new RemoveUnassignedIdentifierQuickFix(state).Fix( inspection.GetInspectionResults(CancellationToken.None).Single(s => s.Target.IdentifierName == "var2")); Assert.AreEqual(expectedCode, state.GetRewriter(component).GetText()); } }
public void VariableUsed_DoesNotReturnResult() { const string inputCode = @"Function Foo() As Boolean Dim var1 as String var1 = ""test"" Goo var1 End Function Sub Goo(ByVal arg1 As String) End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new VariableNotUsedInspection(state); var inspectionResults = inspection.GetInspectionResults(); Assert.AreEqual(0, inspectionResults.Count()); } }
public void EmptyElseBlock_HasWhitespace() { const string inputcode = @"Sub Foo() If True Then Dim a as Long a = 0 Else End If End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputcode, out _); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new EmptyConditionBlockInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var actualResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; const int expectedCount = 1; Assert.AreEqual(expectedCount, actualResults.Count()); }
public void MultilineParameter_ReturnsMultipleResults() { const string inputCode = @"Public Sub Foo( _ ByVal _ Var1 _ As _ Integer, _ ByVal _ Var2 _ As _ Date) End Sub"; IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new MultilineParameterInspection(state); var inspectionResults = inspection.GetInspectionResults(); Assert.AreEqual(2, inspectionResults.Count()); }
public void MultipleDeclarations_IgnoreQuickFixWorks() { const string inputCode = @"Public Sub Foo() Dim var1 As Integer, var2 As String End Sub"; const string expectedCode = @"Public Sub Foo() '@Ignore MultipleDeclarations Dim var1 As Integer, var2 As String End Sub"; IVBComponent component; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out component); var state = MockParser.CreateAndParse(vbe.Object); var inspection = new MultipleDeclarationsInspection(state); var inspectionResults = inspection.GetInspectionResults(); inspectionResults.First().QuickFixes.Single(s => s is IgnoreOnceQuickFix).Fix(); Assert.AreEqual(expectedCode, component.CodeModule.Content()); }
public void IdentifierAnnotationsOnOrBelowIdentifierDoNotGetScopedToIdentifier() { const string inputCode = @" Public foo As Long Public Function Bar() As Variant foo = 42 '@Ignore MissingAttribute '@Ignore EmptyModule End Function"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var fooDeclaration = state.DeclarationFinder.UserDeclarations(DeclarationType.Variable).Single(); var fooReference = fooDeclaration.References.Single(); var expectedAnnotationCount = 0; var actualAnnotationCount = fooReference.Annotations.Count(); Assert.AreEqual(expectedAnnotationCount, actualAnnotationCount); } }
public void LabelNotUsed_ReturnsResult_WithUsedLabelThatDoesNotReturnResult() { const string inputCode = @"Sub Foo() GoTo Label1: label2: label1: End Sub Sub Goo(ByVal arg1 As Integer) End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new LineLabelNotUsedInspection(state); var inspectionResults = inspection.GetInspectionResults(CancellationToken.None); Assert.AreEqual(1, inspectionResults.Count()); } }
public void EmptyElseBlock_HasExecutableStatement() { const string inputCode = @"Sub Foo() If True Then Else Dim d d = 0 End If End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out _); using (var state = MockParser.CreateAndParse(vbe.Object)) { var inspection = new EmptyElseBlockInspection(state); var inspector = InspectionsHelper.GetInspector(inspection); var actualResults = inspector.FindIssuesAsync(state, CancellationToken.None).Result; const int expectedCount = 0; Assert.AreEqual(expectedCount, actualResults.Count()); } }