-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add Dotnet Implementation #81
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
Open
clrudolphi
wants to merge
38
commits into
cucumber:main
Choose a base branch
from
clrudolphi:dotnet
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
8104b9e
Initial commit of project structure.
clrudolphi 8a7a7e9
first class ported
clrudolphi 281e078
Implementation plus tests
clrudolphi 8360374
First cut at fully passing tests.
clrudolphi 5aa6c09
Refactor such that testdata files are read from the file system (rath…
clrudolphi 3327bcf
Enhance Lineage equality and improve timestamp handling
clrudolphi 0c69735
cleanup - per review comments
clrudolphi 828599e
Modified to conform to changes coming in Query #84 (Deprecate lineage…
clrudolphi cec1a90
Merge branch 'main' into dotnet
clrudolphi 65c2338
Merge branch 'main' into dotnet
clrudolphi d37f949
Matching Java implementation; first commit.
clrudolphi 327fed7
Reducing access modifiers on Repository updateXXX methods.
clrudolphi dca52dc
Update CHANGELOG.md
clrudolphi a1fa5f4
Merge branch 'main' into dotnet
clrudolphi ab4ede1
Add support for FindAllUndefinedParameterTypes query.
clrudolphi ce11f7f
Merge branch 'main' into dotnet
clrudolphi aacc93e
Added FindAllStepDefinitions()
clrudolphi 863fcd2
Changes per review comments.
clrudolphi 3d69e28
Restructured folders
clrudolphi 4dc864a
Adjusted paths to testdata folder given solution level folder restruc…
clrudolphi 6b546ca
Code cleanup - formatting.
clrudolphi 08fe99f
Add LICENSE file
clrudolphi af036e9
Cleanup return types of Query methods to IEnumberable<T>, which is mo…
clrudolphi 9462171
Updated CONTRIBUTING.md to include .NET in the list of implementations
clrudolphi 8155e67
Add Directory.Build.props to the solution.
clrudolphi 164c983
Create test-dotnet.yml
clrudolphi 19d95b5
Create release-nuget.yaml
clrudolphi d2f2b43
Create Query.snk
clrudolphi 83b504b
Added signing key for test project.
clrudolphi 32e6634
Added configuration for nuget publishing
clrudolphi 669d655
Temporary: Update workflow to list locations of testdata files
clrudolphi d925be3
Temp: update of test-dotnet
clrudolphi e6b20db
Revert "Temp: update of test-dotnet"
clrudolphi ccef650
Revert "Temporary: Update workflow to list locations of testdata files"
clrudolphi d35a534
Modify how testfolder is found by probing.
clrudolphi 6aedb35
Modify setting in .editorconfig to enforce newline at end of source f…
clrudolphi e7f6db1
Update LICENSE
clrudolphi 4fd7cd9
Modified library name to be consistent with other .NET implementation…
clrudolphi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| ## Ignore Visual Studio temporary files, build results, and | ||
| ## files generated by popular Visual Studio add-ons. | ||
|
|
||
| # User-specific files | ||
| *.suo | ||
| *.user | ||
| *.sln.docstates | ||
| *.ide | ||
|
|
||
| # Build results | ||
|
|
||
| [Dd]ebug/ | ||
| [Rr]elease/ | ||
| x64/ | ||
| build/ | ||
| [Oo]bj/ | ||
| */**/bin | ||
|
|
||
| # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets | ||
| !packages/*/build/ | ||
|
|
||
| # MSTest test Results | ||
| [Tt]est[Rr]esult*/ | ||
| [Bb]uild[Ll]og.* | ||
|
|
||
| *_i.c | ||
| *_p.c | ||
| *.ilk | ||
| *.meta | ||
| *.obj | ||
| *.pch | ||
| *.pdb | ||
| *.pgc | ||
| *.pgd | ||
| *.rsp | ||
| *.sbr | ||
| *.tlb | ||
| *.tli | ||
| *.tlh | ||
| *.tmp | ||
| *.tmp_proj | ||
| *.log | ||
| *.vspscc | ||
| *.vssscc | ||
| .builds | ||
| *.pidb | ||
| *.log | ||
| *.scc | ||
|
|
||
| # Visual C++ cache files | ||
| ipch/ | ||
| *.aps | ||
| *.ncb | ||
| *.opensdf | ||
| *.sdf | ||
| *.cachefile | ||
|
|
||
| # Visual Studio profiler | ||
| *.psess | ||
| *.vsp | ||
| *.vspx | ||
|
|
||
| # Guidance Automation Toolkit | ||
| *.gpState | ||
|
|
||
| # ReSharper is a .NET coding add-in | ||
| _ReSharper*/ | ||
| *.[Rr]e[Ss]harper | ||
|
|
||
| # TeamCity is a build add-in | ||
| _TeamCity* | ||
|
|
||
| # DotCover is a Code Coverage Tool | ||
| *.dotCover | ||
|
|
||
| # NCrunch | ||
| *.ncrunch* | ||
| .*crunch*.local.xml | ||
|
|
||
| # Installshield output folder | ||
| [Ee]xpress/ | ||
|
|
||
| # DocProject is a documentation generator add-in | ||
| DocProject/buildhelp/ | ||
| DocProject/Help/*.HxT | ||
| DocProject/Help/*.HxC | ||
| DocProject/Help/*.hhc | ||
| DocProject/Help/*.hhk | ||
| DocProject/Help/*.hhp | ||
| DocProject/Help/Html2 | ||
| DocProject/Help/html | ||
|
|
||
| # Click-Once directory | ||
| publish/ | ||
|
|
||
| # Publish Web Output | ||
| *.Publish.xml | ||
|
|
||
| # NuGet Packages Directory | ||
| ## TODO: If you have NuGet Package Restore enabled, uncomment the next line | ||
| #packages/ | ||
|
|
||
| # Windows Azure Build Output | ||
| csx | ||
| *.build.csdef | ||
|
|
||
| # Windows Store app package directory | ||
| AppPackages/ | ||
|
|
||
| # Others | ||
| sql/ | ||
| *.Cache | ||
| ClientBin/ | ||
| [Ss]tyle[Cc]op.* | ||
| ~$* | ||
| *~ | ||
| *.dbmdl | ||
| *.[Pp]ublish.xml | ||
| *.pfx | ||
| *.publishsettings | ||
|
|
||
| # RIA/Silverlight projects | ||
| Generated_Code/ | ||
|
|
||
| # Backup & report files from converting an old project file to a newer | ||
| # Visual Studio version. Backup files are not needed, because we have git ;-) | ||
| _UpgradeReport_Files/ | ||
| Backup*/ | ||
| UpgradeLog*.XML | ||
| UpgradeLog*.htm | ||
|
|
||
| # SQL Server files | ||
| App_Data/*.mdf | ||
| App_Data/*.ldf | ||
|
|
||
|
|
||
| #LightSwitch generated files | ||
| GeneratedArtifacts/ | ||
| _Pvt_Extensions/ | ||
| ModelManifest.xml | ||
|
|
||
| # ========================= | ||
| # Windows detritus | ||
| # ========================= | ||
|
|
||
| # Windows image file caches | ||
| Thumbs.db | ||
| ehthumbs.db | ||
|
|
||
| # Folder config file | ||
| Desktop.ini | ||
|
|
||
| # Recycle Bin used on file shares | ||
| $RECYCLE.BIN/ | ||
|
|
||
| # Mac desktop service store files | ||
| .DS_Store | ||
|
|
||
| packages/ | ||
| acceptance/ | ||
| output/ | ||
| .built | ||
| .compared | ||
| .sln_built_debug | ||
| *.userprefs | ||
| *.nupkg | ||
| Gherkin.NuGetPackages/bin/ | ||
| .build* | ||
| .built* | ||
| .vscode | ||
| .run_tests | ||
| .generated | ||
| .packed | ||
| .tested | ||
| .fixprotoc | ||
| .vs/ | ||
|
|
||
| # ======================== | ||
| # Query project specific ignore settings | ||
| Query/QueryTest/testdata/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 17 | ||
| VisualStudioVersion = 17.14.36221.1 d17.14 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Query", "Query\Query.csproj", "{01EF081E-A17A-4630-9C7D-40BA4BE3F9BC}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryTest", "QueryTest\QueryTest.csproj", "{F0EA5832-C5B7-42CF-9BDB-6EE21C589C8B}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {01EF081E-A17A-4630-9C7D-40BA4BE3F9BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {01EF081E-A17A-4630-9C7D-40BA4BE3F9BC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {01EF081E-A17A-4630-9C7D-40BA4BE3F9BC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {01EF081E-A17A-4630-9C7D-40BA4BE3F9BC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {F0EA5832-C5B7-42CF-9BDB-6EE21C589C8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {F0EA5832-C5B7-42CF-9BDB-6EE21C589C8B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {F0EA5832-C5B7-42CF-9BDB-6EE21C589C8B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {F0EA5832-C5B7-42CF-9BDB-6EE21C589C8B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {923928DC-6FB0-4C25-9B2B-721A9B60C602} | ||
| EndGlobalSection | ||
| EndGlobal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System; | ||
| using Io.Cucumber.Messages.Types; | ||
|
|
||
| namespace Io.Cucumber.Query | ||
| { | ||
| // port of io.cucumber.query.LineageReducer<T> (Java) | ||
| public interface ILineageReducer<T> | ||
| { | ||
| T Reduce(Lineage lineage); | ||
| T Reduce(Lineage lineage, Pickle pickle); | ||
| } | ||
|
|
||
| // port of io.cucumber.query.LineageReducer.Collector<T> (Java) | ||
| public interface ICollector<T> | ||
| { | ||
| void Add(GherkinDocument document); | ||
| void Add(Feature feature); | ||
| void Add(Rule rule); | ||
| void Add(Scenario scenario); | ||
| void Add(Examples examples, int index); | ||
| void Add(TableRow example, int index); | ||
| void Add(Pickle pickle); | ||
| T Finish(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #nullable enable | ||
| using System.ComponentModel.DataAnnotations; | ||
| using System; | ||
| using Io.Cucumber.Messages.Types; | ||
|
|
||
| namespace Io.Cucumber.Query; | ||
|
|
||
| /// <summary> | ||
| /// A structure containing all ancestors of a given | ||
| /// <see cref="GherkinDocument"/> element or <see cref="Pickle"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// See <see cref="LineageReducer"/>. | ||
| /// </remarks> | ||
| public class Lineage : IEquatable<Lineage> | ||
| { | ||
| private readonly GherkinDocument _document; | ||
| private readonly Feature? _feature; | ||
| private readonly Rule? _rule; | ||
| private readonly Scenario? _scenario; | ||
| private readonly Examples? _examples; | ||
| private readonly int? _examplesIndex; | ||
| private readonly TableRow? _example; | ||
| private readonly int? _exampleIndex; | ||
|
|
||
| internal Lineage([Required] GherkinDocument document) : this(document, null, null, null, null, null, null, null) { } | ||
|
|
||
| internal Lineage(Lineage parent, Feature feature) | ||
| : this(parent._document, feature, null, null, null, null, null, null) { } | ||
|
|
||
| internal Lineage(Lineage parent, Rule rule) | ||
| : this(parent._document, parent._feature, rule, null, null, null, null, null) { } | ||
|
|
||
| internal Lineage(Lineage parent, Scenario scenario) | ||
| : this(parent._document, parent._feature, parent._rule, scenario, null, null, null, null) { } | ||
|
|
||
| internal Lineage(Lineage parent, Examples examples, int examplesIndex) | ||
| : this(parent._document, parent._feature, parent._rule, parent._scenario, examples, examplesIndex, null, null) { } | ||
|
|
||
| internal Lineage(Lineage parent, TableRow example, int exampleIndex) | ||
| : this(parent._document, parent._feature, parent._rule, parent._scenario, parent._examples, parent._examplesIndex, example, exampleIndex) { } | ||
|
|
||
| private Lineage( | ||
| [Required] GherkinDocument document, | ||
| Feature? feature, | ||
| Rule? rule, | ||
| Scenario? scenario, | ||
| Examples? examples, | ||
| int? examplesIndex, | ||
| TableRow? example, | ||
| int? exampleIndex) | ||
| { | ||
| _document = document ?? throw new ArgumentNullException(nameof(document)); | ||
| _feature = feature; | ||
| _rule = rule; | ||
| _scenario = scenario; | ||
| _examples = examples; | ||
| _examplesIndex = examplesIndex; | ||
| _example = example; | ||
| _exampleIndex = exampleIndex; | ||
| } | ||
|
|
||
| public GherkinDocument Document => _document; | ||
| public Feature? Feature => _feature; | ||
| public Rule? Rule => _rule; | ||
| public Scenario? Scenario => _scenario; | ||
| public Examples? Examples => _examples; | ||
| public TableRow? Example => _example; | ||
| public int? ExamplesIndex => _examplesIndex; | ||
| public int? ExampleIndex => _exampleIndex; | ||
|
|
||
| public bool Equals(Lineage? other) | ||
| { | ||
| if (ReferenceEquals(this, other)) return true; | ||
| if (other is null) return false; | ||
| return Equals(_document, other._document) | ||
| && Equals(_feature, other._feature) | ||
| && Equals(_rule, other._rule) | ||
| && Equals(_scenario, other._scenario) | ||
| && Equals(_examples, other._examples) | ||
| && Equals(_example, other._example) | ||
| && Equals(_examplesIndex, other._examplesIndex) | ||
| && Equals(_exampleIndex, other._exampleIndex); | ||
| } | ||
|
|
||
| public override bool Equals(object? obj) => Equals(obj as Lineage); | ||
|
|
||
| public override int GetHashCode() | ||
| { | ||
| return (_document, _feature, _rule, _scenario, _examples, _example, _examplesIndex, _exampleIndex).GetHashCode(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| using System; | ||
| using Io.Cucumber.Messages.Types; | ||
|
|
||
| namespace Io.Cucumber.Query | ||
| { | ||
| // port of io.cucumber.query.LineageReducerAscending (Java) | ||
| public class LineageReducerAscending<T> : ILineageReducer<T> | ||
| { | ||
| private readonly Func<ICollector<T>> _collectorSupplier; | ||
|
|
||
| public LineageReducerAscending(Func<ICollector<T>> collectorSupplier) | ||
| { | ||
| _collectorSupplier = collectorSupplier ?? throw new ArgumentNullException(nameof(collectorSupplier)); | ||
| } | ||
|
|
||
| public T Reduce(Lineage lineage) | ||
| { | ||
| var collector = _collectorSupplier(); | ||
| ReduceAddLineage(collector, lineage); | ||
| return collector.Finish(); | ||
| } | ||
|
|
||
| public T Reduce(Lineage lineage, Pickle pickle) | ||
| { | ||
| var collector = _collectorSupplier(); | ||
| collector.Add(pickle); | ||
| ReduceAddLineage(collector, lineage); | ||
| return collector.Finish(); | ||
| } | ||
|
|
||
| private static void ReduceAddLineage(ICollector<T> collector, Lineage lineage) | ||
| { | ||
| if (lineage.Example != null) | ||
| collector.Add(lineage.Example, lineage.ExampleIndex ?? 0); | ||
| if (lineage.Examples != null) | ||
| collector.Add(lineage.Examples, lineage.ExamplesIndex ?? 0); | ||
| if (lineage.Scenario != null) | ||
| collector.Add(lineage.Scenario); | ||
| if (lineage.Rule != null) | ||
| collector.Add(lineage.Rule); | ||
| if (lineage.Feature != null) | ||
| collector.Add(lineage.Feature); | ||
| if (lineage.Document != null) | ||
| collector.Add(lineage.Document); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.