Skip to content

Commit

Permalink
Adapt tests and project generation for .NET Core 3 (#1688)
Browse files Browse the repository at this point in the history
* cleanup usings

* reorder variable

* rename and change values of TFM constants

* rename constants to describe the value

* cleanup file

* update submodule

* add test run combinations for .NET Core 3.0

* update build.yml to use .NET Core 3 preview 7

* use older NETCore 3 preview

* add PowerShell task to output dotnet --info

* add global.json to solution for using NETCoreSdk3

* add netcoreapp3.0 as TFM for unit tests

* update submodule

* split up named attribute values collection

* fix crlf

* update submodule

* add SpecFlowAttributesFilter

* use SpecFlowAttributesFilter

* update submodule

* update submodule to master

* remove running tests for netcoreapp2.0
  • Loading branch information
david1995 authored and SabotageAndi committed Aug 2, 2019
1 parent 57de28c commit f26c4c8
Show file tree
Hide file tree
Showing 16 changed files with 315 additions and 185 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<SpecFlow_Core_Generator_TFM>netstandard2.0</SpecFlow_Core_Generator_TFM>

<SpecFlow_FullFramework_Test_TFM>net471</SpecFlow_FullFramework_Test_TFM>
<SpecFlow_Core_Test_TFM>netcoreapp2.0;netcoreapp2.1</SpecFlow_Core_Test_TFM>
<SpecFlow_Core_Test_TFM>netcoreapp2.1;netcoreapp3.0</SpecFlow_Core_Test_TFM>

<SpecFlow_FullFramework_Specs_TFM>net471</SpecFlow_FullFramework_Specs_TFM>

Expand Down
2 changes: 1 addition & 1 deletion ExternalRepositories/SpecFlow.TestProjectGenerator
1 change: 1 addition & 0 deletions TechTalk.SpecFlow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
changelog.txt = changelog.txt
clean.ps1 = clean.ps1
CommonAssemblyInfo.cs = CommonAssemblyInfo.cs
global.json = global.json
LICENSE.txt = LICENSE.txt
nuget.config = nuget.config
README.md = README.md
Expand Down
232 changes: 116 additions & 116 deletions TechTalk.SpecFlow/Attributes.cs
Original file line number Diff line number Diff line change
@@ -1,127 +1,127 @@
using System;
using TechTalk.SpecFlow.Bindings;

namespace TechTalk.SpecFlow
{
/// <summary>
/// Marker attribute that specifies that this class may contain bindings (step definitions, hooks, etc.)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class BindingAttribute : Attribute
{
}

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public abstract class StepDefinitionBaseAttribute : Attribute
{
internal StepDefinitionType[] Types { get; private set; }
public string Regex { get; set; }

using System;
using TechTalk.SpecFlow.Bindings;

namespace TechTalk.SpecFlow
{
/// <summary>
/// Marker attribute that specifies that this class may contain bindings (step definitions, hooks, etc.)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class BindingAttribute : Attribute
{
}

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public abstract class StepDefinitionBaseAttribute : Attribute
{
internal StepDefinitionType[] Types { get; private set; }
public string Regex { get; set; }

/// <summary>
/// additional information in which culture the step is written
/// it does not affect the matching of the step
/// it is only for tooling support needed
/// </summary>
public string Culture { get; set; }

internal StepDefinitionBaseAttribute(string regex, StepDefinitionType type)
: this(regex, new[] { type })
{
}

protected StepDefinitionBaseAttribute(string regex, StepDefinitionType[] types)
{
if (types == null) throw new ArgumentNullException("types");
if (types.Length == 0) throw new ArgumentException("List cannot be empty", "types");

Regex = regex;
Types = types;
}
}

/// <summary>
/// Specifies a 'Given' step definition that matches for the provided regular expression.
/// </summary>
public class GivenAttribute : StepDefinitionBaseAttribute
{
public GivenAttribute() : this(null)
{
}


public GivenAttribute(string regex)
: base(regex, StepDefinitionType.Given)
{
}

/// </summary>
public string Culture { get; set; }

internal StepDefinitionBaseAttribute(string regex, StepDefinitionType type)
: this(regex, new[] { type })
{
}

protected StepDefinitionBaseAttribute(string regex, StepDefinitionType[] types)
{
if (types == null) throw new ArgumentNullException("types");
if (types.Length == 0) throw new ArgumentException("List cannot be empty", "types");

Regex = regex;
Types = types;
}
}

/// <summary>
/// Specifies a 'Given' step definition that matches for the provided regular expression.
/// </summary>
public class GivenAttribute : StepDefinitionBaseAttribute
{
public GivenAttribute() : this(null)
{
}


public GivenAttribute(string regex)
: base(regex, StepDefinitionType.Given)
{
}

public GivenAttribute(string regex, string culture)
: this(regex)
{
Culture = culture;
}
}

/// <summary>
/// Specifies a 'When' step definition that matches for the provided regular expression.
/// </summary>
public class WhenAttribute : StepDefinitionBaseAttribute
{
public WhenAttribute() : this(null)
{
}

public WhenAttribute(string regex)
: base(regex, StepDefinitionType.When)
{
}

: this(regex)
{
Culture = culture;
}
}

/// <summary>
/// Specifies a 'When' step definition that matches for the provided regular expression.
/// </summary>
public class WhenAttribute : StepDefinitionBaseAttribute
{
public WhenAttribute() : this(null)
{
}

public WhenAttribute(string regex)
: base(regex, StepDefinitionType.When)
{
}

public WhenAttribute(string regex, string culture)
: this(regex)
{
Culture = culture;
}
}

/// <summary>
/// Specifies a 'Then' step definition that matches for the provided regular expression.
/// </summary>
public class ThenAttribute : StepDefinitionBaseAttribute
{
public ThenAttribute() : this(null)
{
}

public ThenAttribute(string regex)
: base(regex, StepDefinitionType.Then)
{
: this(regex)
{
Culture = culture;
}
}

/// <summary>
/// Specifies a 'Then' step definition that matches for the provided regular expression.
/// </summary>
public class ThenAttribute : StepDefinitionBaseAttribute
{
public ThenAttribute() : this(null)
{
}

public ThenAttribute(string regex)
: base(regex, StepDefinitionType.Then)
{
}

public ThenAttribute(string regex, string culture)
: this(regex)
{
Culture = culture;
}
}

/// <summary>
/// Specifies a step definition that matches for the provided regular expression and any step kinds (given, when, then).
/// </summary>
public class StepDefinitionAttribute : StepDefinitionBaseAttribute
{
public StepDefinitionAttribute()
: this(null)
{
}

public StepDefinitionAttribute(string regex)
: base(regex, new[] { StepDefinitionType.Given, StepDefinitionType.When, StepDefinitionType.Then })
{
}

: this(regex)
{
Culture = culture;
}
}

/// <summary>
/// Specifies a step definition that matches for the provided regular expression and any step kinds (given, when, then).
/// </summary>
public class StepDefinitionAttribute : StepDefinitionBaseAttribute
{
public StepDefinitionAttribute()
: this(null)
{
}

public StepDefinitionAttribute(string regex)
: base(regex, new[] { StepDefinitionType.Given, StepDefinitionType.When, StepDefinitionType.Then })
{
}

public StepDefinitionAttribute(string regex, string culture)
: this(regex)
{
Culture = culture;
}
}
: this(regex)
{
Culture = culture;
}
}
}
10 changes: 10 additions & 0 deletions TechTalk.SpecFlow/Bindings/Discovery/ISpecFlowAttributesFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;

namespace TechTalk.SpecFlow.Bindings.Discovery
{
public interface ISpecFlowAttributesFilter
{
IEnumerable<Attribute> FilterForSpecFlowAttributes(IEnumerable<Attribute> customAttributes);
}
}
Loading

0 comments on commit f26c4c8

Please sign in to comment.