Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosch250 committed May 29, 2015
2 parents e555c7f + c7cd4bf commit a2c03d4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 26 deletions.
4 changes: 4 additions & 0 deletions RetailCoder.VBE/UI/CodeInspections/CodeInspectionsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ public CodeInspectionsWindow()

CodeIssuesGridView.AutoResizeColumns();
CodeIssuesGridView.Columns["Issue"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
CodeIssuesGridView.Columns["Issue"].HeaderText = RubberduckUI.Issue;

CodeIssuesGridView.SelectionChanged += CodeIssuesGridView_SelectionChanged;
CodeIssuesGridView.CellDoubleClick += CodeIssuesGridView_CellDoubleClick;

NextButton.Text = RubberduckUI.CodeInspections_NavigateToNextIssue;
PreviousButton.Text = RubberduckUI.CodeInspections_NavigateToPreviousIssue;
}

public void ToggleParsingStatus(bool enabled = true)
Expand Down
2 changes: 1 addition & 1 deletion RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions RetailCoder.VBE/UI/RubberduckUI.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
<data name="CodeInspections_Inspecting" xml:space="preserve">
<value>Inspection...</value>
</data>
<data name="CodeInspections_NoIssues" xml:space="preserve">
<data name="CodeInspections_StatusOK" xml:space="preserve">
<value>OK</value>
</data>
<data name="ExtractMethod_OutputNone" xml:space="preserve">
Expand Down Expand Up @@ -514,7 +514,7 @@ Attention: les valeurs personnalisées seront perdues.</value>
<data name="Name" xml:space="preserve">
<value>Nom</value>
</data>
<data name="Next" xml:space="preserve">
<data name="NavigateNextIssue" xml:space="preserve">
<value>Suivant</value>
</data>
<data name="Offline" xml:space="preserve">
Expand All @@ -526,10 +526,10 @@ Attention: les valeurs personnalisées seront perdues.</value>
<data name="Parameter" xml:space="preserve">
<value>Paramètre</value>
</data>
<data name="Passed" xml:space="preserve">
<value>Succès</value>
<data name="ExtractMethod_ParamPassedBy" xml:space="preserve">
<value>Passé</value>
</data>
<data name="Previous" xml:space="preserve">
<data name="NavigatePreviousIssue" xml:space="preserve">
<value>Précédent</value>
</data>
<data name="Severity" xml:space="preserve">
Expand Down
37 changes: 33 additions & 4 deletions Rubberduck.UnitTesting/NewUnitTestModuleCommand.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Vbe.Interop;
using Rubberduck.VBEditor.Extensions;

namespace Rubberduck.UnitTesting
{
public static class NewUnitTestModuleCommand
{
private static readonly string TestModuleEmptyTemplate = string.Concat(
public static void EnsureReferenceToAddInLibrary(this VBProject project)
{
var assembly = Assembly.GetExecutingAssembly();

var name = assembly.GetName().Name.Replace('.', '_');
var referencePath = Path.ChangeExtension(assembly.Location, ".tlb");

var references = project.References.Cast<Reference>().ToList();

var reference = references.SingleOrDefault(r => r.Name == name);
if (reference != null)
{
project.References.Remove(reference);
}

if (references.All(r => r.FullPath != referencePath))
{
project.References.AddFromFile(referencePath);
}
}

private static readonly string TestModuleEmptyTemplate = String.Concat(
"'@TestModule\n"
, "'' uncomment for late-binding:\n"
, "'Private Assert As Object\n"
, "'' early-binding requires reference to Rubberduck.UnitTesting.tlb:\n"
, "Private Assert As New Rubberduck_UnitTesting.AssertClass\n\n"
,"'@ModuleInitialize\n"
, "'@ModuleInitialize\n"
,"Public Sub ModuleInitialize()\n"
," 'this method runs once per module.\n"
," '' uncomment for late-binding:\n"
," 'Set Assert = CreateObject(\"Rubberduck_UnitTesting.AssertClass\")\n"
,"End Sub\n\n"
, "'@ModuleCleanup\n"
, "Public Sub ModuleCleanup()\n"
Expand Down Expand Up @@ -46,7 +75,7 @@ public static void NewUnitTestModule(VBE vbe)
hasOptionExplicit = module.CodeModule.Lines[1, module.CodeModule.CountOfDeclarationLines].Contains("Option Explicit");
}

var options = string.Concat(hasOptionExplicit ? string.Empty : "Option Explicit\n", "Option Private Module\n\n");
var options = String.Concat(hasOptionExplicit ? String.Empty : "Option Explicit\n", "Option Private Module\n\n");

module.CodeModule.AddFromString(options + TestModuleEmptyTemplate);
module.Activate();
Expand All @@ -61,7 +90,7 @@ private static string GetNextTestModuleName(VBProject project)
var names = project.ComponentNames();
var index = names.Count(n => n.StartsWith(TestModuleBaseName)) + 1;

return string.Concat(TestModuleBaseName, index);
return String.Concat(TestModuleBaseName, index);
}
}
}
3 changes: 3 additions & 0 deletions Rubberduck.UnitTesting/Rubberduck.UnitTesting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy $(TargetDir)$(ProjectName).tlb $(SolutionDir)RetailCoder.VBE\$(OutDir)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
16 changes: 0 additions & 16 deletions Rubberduck.VBEEditor/Extensions/VbProjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ public static IEnumerable<string> ComponentNames(this VBProject project)
}
}

public static void EnsureReferenceToAddInLibrary(this VBProject project)
{
var referencePath = Path.ChangeExtension(Assembly.GetExecutingAssembly().Location, ".tlb");

List<Reference> existing = project.References.Cast<Reference>().Where(r => r.Name == "Rubberduck").ToList();
foreach (Reference reference in existing)
{
project.References.Remove(reference);
}

if (project.References.Cast<Reference>().All(r => r.FullPath != referencePath))
{
project.References.AddFromFile(referencePath);
}
}

/// <summary>
/// Exports all code modules in the VbProject to a destination directory. Files are given the same name as their parent code Module name and file extensions are based on what type of code Module it is.
/// </summary>
Expand Down

0 comments on commit a2c03d4

Please sign in to comment.