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

5 test case arguments dont parse for release dll builds #7

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ public FeatureExtractor(

public SpecFlowAssembly ExtractFeatures(AssemblyDefinition assembly)
{
var assemblyName = assembly.Name.Name;

var isDebug = IsDebugBuild(assembly);
var assemblyName =
assembly
.Name
.Name;

_logger
.LogInformation($"Assembly name: [{assemblyName}]");

var isDebug = IsDebugBuild(assembly);

_logger
.LogInformation($"Debug build: [{isDebug}]");

Expand Down Expand Up @@ -151,14 +154,14 @@ public SpecFlowAssembly ExtractFeatures(AssemblyDefinition assembly)
return result;
}

private static bool IsDebugBuild(AssemblyDefinition assembly)
private bool IsDebugBuild(ICustomAttributeProvider assembly)
{
var customAttributes =
assembly
.CustomAttributes;

var debuggableAttribute =
customAttributes
(customAttributes ?? Enumerable.Empty<CustomAttribute>())
.FirstOrDefault(o => o.AttributeType.FullName == typeof(DebuggableAttribute).FullName);

if (debuggableAttribute != null)
Expand All @@ -170,10 +173,13 @@ private static bool IsDebugBuild(AssemblyDefinition assembly)

if (debuggingMode.Value != null)
{
_logger
.LogInformation($"Debugging attribute value: [{debuggingMode.Value}]");

var attributes =
(DebuggableAttribute.DebuggingModes)Enum.Parse(
typeof(DebuggableAttribute.DebuggingModes),
debuggingMode.Value?.ToString()
(debuggingMode.Value ?? string.Empty).ToString()
);
return
attributes
Expand Down