Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdditionalResolutionDirectories for console app #48

Open
wants to merge 1 commit into
base: Revit2017
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Framework/Runner/Interfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public interface IRunnerSetupData
bool IsTesting { get; set; }
string ExcludedCategory { get; set; }
int SelectedProduct { get; set; }
string AdditionalResolutionDirectories { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type shoud be List

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ";" separated list of path into one string, so that OptionSet can work seamlessly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see that you mean to pass multiple directories in one string separated by ";".

}

public interface IRunner
Expand Down
17 changes: 15 additions & 2 deletions src/Framework/Runner/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,6 @@ public Runner()
/// <param name="setupData"></param>
public Runner(IRunnerSetupData setupData)
{
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;

if (!String.IsNullOrEmpty(setupData.TestAssembly) && !File.Exists(setupData.TestAssembly))
{
throw new ArgumentException("The specified test assembly does not exist.");
Expand Down Expand Up @@ -428,6 +426,20 @@ public Runner(IRunnerSetupData setupData)
IsTesting = setupData.IsTesting;
ExcludedCategory = setupData.ExcludedCategory;

if(!string.IsNullOrEmpty(setupData.AdditionalResolutionDirectories))
{
var splits = setupData.AdditionalResolutionDirectories.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
if (!splits.Any()) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to throw an exception to let users know there is an error


this.AdditionalResolutionDirectories.Clear();
foreach (var split in splits)
{
this.AdditionalResolutionDirectories.Add(split);
}
}
var resolver = new DefaultAssemblyResolver(RevitPath, AdditionalResolutionDirectories);
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += resolver.Resolve;

Initialize();
}

Expand Down Expand Up @@ -1784,6 +1796,7 @@ public static IRunnerSetupData ParseCommandLineArguments(IEnumerable<string> arg
{"exclude:", "The name of a test category to exclude. This has a higher priortiy than other settings. If a specified category is set here, any test cases that belongs to that category will not be run. (OPTIONAL)", v=> setupData.ExcludedCategory = v},
{"c|concatenate", "Concatenate the results from this run of RTF with an existing results file if one exists at the path specified. The default behavior is to replace the existing results file. (OPTIONAL)", v=> setupData.Concat = v != null},
{"revit:", "The Revit executable to be used for testing. If no executable is specified, RTF will use the first version of Revit that is found on the machine using the RevitAddinUtility. (OPTIONAL)", v=> setupData.RevitPath = v},
{"add:", @"Additional path resolution directories as a string separated by ';'", v=>setupData.AdditionalResolutionDirectories=v},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor. But how about additionalDirs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for some smaller name, maybe I can call it "paths:"

{"copyAddins", "Specify whether to copy the addins from the Revit folder to the current working directory. Copying the addins from the Revit folder will cause the test process to simulate the typical setup on your machine. (OPTIONAL)",
v=> setupData.CopyAddins = v != null},
{"dry", "Conduct a dry run. (OPTIONAL)", v=> setupData.DryRun = v != null},
Expand Down
1 change: 1 addition & 0 deletions src/Framework/Runner/RunnerSetupData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class RunnerSetupData : IRunnerSetupData
public bool CopyAddins { get; set; }
public bool IsTesting { get; set; }
public int SelectedProduct { get; set; }
public string AdditionalResolutionDirectories { get; set; }

public RunnerSetupData()
{
Expand Down
Binary file modified tools/Output/RevitTestFrameworkInstaller2017.exe
Binary file not shown.