Skip to content

Commit

Permalink
Fix: export test components with test classes (#51)
Browse files Browse the repository at this point in the history
* * Export Test Classes: + option to include TestComponents
  • Loading branch information
josef-poetzl authored Mar 23, 2024
1 parent de398f8 commit 21d0d91
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Binary file modified access-add-in/AccUnitLoader.accda
Binary file not shown.
2 changes: 1 addition & 1 deletion access-add-in/source/vcs-options.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Info": {
"AddinVersion": "4.0.34",
"AddinVersion": "4.0.35",
"AccessVersion": "16.0 32-bit"
},
"Options": {
Expand Down
Binary file modified excel-add-in/AccUnitLoader.xlam
Binary file not shown.
6 changes: 3 additions & 3 deletions source/AccUnit/Configuration/Configurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IConfigurator
void RemoveTestEnvironment(bool RemoveTestModules = false, bool ExportModulesBeforeRemoving = true, [MarshalAs(UnmanagedType.IDispatch)] object VBProject = null);
void InsertAccUnitLoaderFactoryModule(bool UseAccUnitTypeLib, bool RemoveIfExists = false, [MarshalAs(UnmanagedType.IDispatch)] object VBProject = null, object HostApplication = null);
void RemoveAccUnitLoaderFactoryModule([MarshalAs(UnmanagedType.IDispatch)] object VBProject = null);
void ExportTestClasses(string ExportPath = null, [MarshalAs(UnmanagedType.IDispatch)] object VBProject = null);
void ExportTestClasses(string ExportPath = null, [MarshalAs(UnmanagedType.IDispatch)] object VBProject = null, bool ExportTestComponents = true);
void ImportTestClasses(string FileNameFilter = null, string ImportPath = null, [MarshalAs(UnmanagedType.IDispatch)] object VBProject = null);

IUserSettings UserSettings { get; }
Expand Down Expand Up @@ -127,15 +127,15 @@ private void RemoveAccUnitTlbReference()
}
}

public void ExportTestClasses(string exportPath = null, object vbProject = null)
public void ExportTestClasses(string exportPath = null, object vbProject = null, bool exportTestComponents = true)
{
if (vbProject != null)
_vbProject = (VBProject)vbProject;

OfficeApplicationHelper officeApplicationHelper = new VBProjectOnlyApplicatonHelper(_vbProject);
using (var testClassManager = new TestClassManager(officeApplicationHelper))
{
testClassManager.ExportTestClasses(exportPath);
testClassManager.ExportTestClasses(exportPath, exportTestComponents);
}
}

Expand Down
11 changes: 10 additions & 1 deletion source/AccUnit/Configuration/TestClassManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static OfficeObjectInfo GetObjectInfo(string name)
}
}

public void ExportTestClasses(string exportDirectory = null)
public void ExportTestClasses(string exportDirectory = null, bool exportTestComponents = false)
{
if (exportDirectory is null)
{
Expand All @@ -160,6 +160,15 @@ public void ExportTestClasses(string exportDirectory = null)
{
ExportTestClass(testClassInfo.Name, exportDirectory);
}

if (exportTestComponents)
{
var components = new TestClassReader(ActiveVBProject).GetTestComponents();
foreach (var c in components)
{
ExportTestClass(c.Name, exportDirectory);
}
}
}

public void DeleteFactoryCodeModule()
Expand Down
4 changes: 2 additions & 2 deletions source/AccUnit/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.4.0")]
[assembly: AssemblyFileVersion("0.9.4.0")]
[assembly: AssemblyVersion("0.9.5.0")]
[assembly: AssemblyFileVersion("0.9.5.0")]

0 comments on commit 21d0d91

Please sign in to comment.