generated from hughesjs/dotnet-8-ci-cd-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,253 @@ | ||
Name: "IPgfPlotBuilder" | ||
Namespace: "PgfPlotsSdk.Public.Generated" | ||
InitialState: | ||
Name: "CreateBuilder" | ||
CanTransitionTo: | ||
- "AddPgfPlotWithAxes" | ||
- "AddPgfPlot" | ||
- "AddFigure" | ||
Methods: | ||
- Name: "AddFigure" | ||
ReturnType: "FigureBuilder" | ||
Arguments: | ||
- Name: "figureOptions" | ||
Type: "FigureOptions?" | ||
CanTransitionTo: | ||
- "AddPgfPlotWithAxes" | ||
- "AddPgfPlot" | ||
- "SetCaption" | ||
- "SetLabel" | ||
- "SetPlacementFlag" | ||
- Name: "AddPgfPlotWithAxes" | ||
Arguments: | ||
- Name: "axisType" | ||
Type: "AxisType" | ||
- Name: "options" | ||
Type: "AxisOptions?" | ||
CanTransitionTo: &AxisSettingsCircular | ||
- "AddPlot" | ||
- "SetXLabel" | ||
- "SetYLabel" | ||
- "SetXMin" | ||
- "SetYMin" | ||
- "SetXMax" | ||
- "SetYMax" | ||
- "SetMinorXTickNumber" | ||
- "SetMinorYTickNumber" | ||
- "SetXTicks" | ||
- "SetYTicks" | ||
- "SetGrid" | ||
- Name: "SetXLabel" | ||
Arguments: | ||
- Name: "label" | ||
Type: "string?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetYLabel" | ||
Arguments: | ||
- Name: "label" | ||
Type: "string?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetXMin" | ||
Arguments: | ||
- Name: "min" | ||
Type: "float?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetYMin" | ||
Arguments: | ||
- Name: "min" | ||
Type: "float?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetXMax" | ||
Arguments: | ||
- Name: "max" | ||
Type: "float?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetYMax" | ||
Arguments: | ||
- Name: "max" | ||
Type: "float?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetMinorXTickNumber" | ||
Arguments: | ||
- Name: "number" | ||
Type: "int?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetMinorYTickNumber" | ||
Arguments: | ||
- Name: "number" | ||
Type: "int?" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetXTicks" | ||
Arguments: | ||
- Name: "ticks" | ||
Type: "params float[]" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "SetYTicks" | ||
Arguments: | ||
- Name: "ticks" | ||
Type: "params float[]" | ||
CanTransitionTo: *AxisSettingsCircular | ||
- Name: "AddPgfPlot" | ||
CanTransitionTo: | ||
- "AddPie" | ||
- Name: "AddPie" | ||
Arguments: | ||
- Name: "slices" | ||
Type: "IEnumerable<PieChartSliceData<T>>" | ||
- Name: "options" | ||
Type: "PieChartOptions?" | ||
CanTransitionTo: &PieSettingsCircular | ||
- "AddPie" | ||
- "Build" | ||
- "SetRadius" | ||
- "SetHideNumber" | ||
- "SetReferenceSum" | ||
- "SetRotation" | ||
- "SetCentrePosition" | ||
- "SetScaleFont" | ||
- "SetSliceColours" | ||
- "SetTextPosition" | ||
- "SetAfterNumberText" | ||
- "SetBeforeNumberText" | ||
- "SetPieChartType" | ||
- "SetSliceExplosionFactors" | ||
- Name: "SetRadius" | ||
Arguments: | ||
- Name: "radius" | ||
Type: "float?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetHideNumber" | ||
Arguments: | ||
- Name: "enabled" | ||
Type: "bool?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetReferenceSum" | ||
Arguments: | ||
- Name: "referenceSum" | ||
Type: "float?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetRotation" | ||
Arguments: | ||
- Name: "rotation" | ||
Type: "float?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetCentrePosition" | ||
Arguments: | ||
- Name: "x" | ||
Type: "float" | ||
- Name: "y" | ||
Type: "float" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetScaleFont" | ||
Arguments: | ||
- Name: "enabled" | ||
Type: "bool?" | ||
- Name: "SetSliceColours" | ||
Arguments: | ||
- Name: "colours" | ||
Type: "params LatexColour[]" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetTextPosition" | ||
Arguments: | ||
- Name: "textPosition" | ||
Type: "PieTextOption?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetAfterNumberText" | ||
Arguments: | ||
- Name: "afterText" | ||
Type: "string?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetBeforeNumberText" | ||
Arguments: | ||
- Name: "beforeText" | ||
Type: "string?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetPieChartType" | ||
Arguments: | ||
- Name: "type" | ||
Type: "PieType?" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "SetSliceExplosionFactors" | ||
Arguments: | ||
- Name: "factors" | ||
Type: "params float[]" | ||
CanTransitionTo: *PieSettingsCircular | ||
- Name: "AddPlot" | ||
Arguments: | ||
- Name: "data" | ||
Type: "IEnumerable<LatexData>" | ||
- Name: "options" | ||
Type: "PlotOptions?" | ||
CanTransitionTo: &PlotOptionsCircular | ||
- "AddPlot" | ||
- "Build" | ||
- "SetColour" | ||
- "SetBarType" | ||
- "SetMark" | ||
- "SetSmooth" | ||
- "SetBarWidth" | ||
- "SetFillColour" | ||
- "SetFillOpacity" | ||
- "SetLineStyle" | ||
- "SetLineWidth" | ||
- "SetMarkSize" | ||
- "SetOnlyMarks" | ||
- Name: "SetColour" | ||
Arguments: | ||
- Name: "colour" | ||
Type: "LatexColour?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetBarType" | ||
Arguments: | ||
- Name: "type" | ||
Type: "BarType?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetMark" | ||
Arguments: | ||
- Name: "mark" | ||
Type: "PlotMark?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetSmooth" | ||
Arguments: | ||
- Name: "enabled" | ||
Type: "bool?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetBarWidth" | ||
Arguments: | ||
- Name: "width" | ||
Type: "float?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetFillColour" | ||
Arguments: | ||
- Name: "colour" | ||
Type: "LatexColour?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetFillOpacity" | ||
Arguments: | ||
- Name: "opacity" | ||
Type: "float?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetLineStyle" | ||
Arguments: | ||
- Name: "style" | ||
Type: "LineStyle?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetLineWidth" | ||
Arguments: | ||
- Name: "width" | ||
Type: "float?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetMarkSize" | ||
Arguments: | ||
- Name: "size" | ||
Type: "float?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "SetOnlyMarks" | ||
Arguments: | ||
- Name: "enabled" | ||
Type: "bool?" | ||
CanTransitionTo: *PlotOptionsCircular | ||
- Name: "Build" | ||
Arguments: [] | ||
CanTransitionTo: [] | ||
ReturnType: "string" |
89 changes: 89 additions & 0 deletions
89
src/SuperFluid.Tests/SourceGenerators/GeneratedBuilderTests.cs
This file contains 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,89 @@ | ||
using SuperFluid.Tests.Cars; | ||
|
||
namespace SuperFluid.Tests.SourceGenerators; | ||
|
||
public class GeneratedBuilderTests | ||
{ | ||
/// <summary> | ||
/// The real test is if this builds | ||
/// </summary> | ||
[Fact] | ||
public void CanGenerateDemoApi() | ||
{ | ||
string states = CarActor.Initialize() | ||
.Unlock() | ||
.Enter() | ||
.Start(10, "right") | ||
.Stop() | ||
.Start(20, "left") | ||
.Stop() | ||
.Exit() | ||
.Enter() | ||
.Start(30, "right") | ||
.Stop() | ||
.Exit() | ||
.Lock() | ||
.Build("red"); | ||
|
||
states.ShouldBe("Unlock Enter Start 10 right Stop Start 20 left Stop Exit Enter Start 30 right Stop Exit Lock Build red"); | ||
} | ||
|
||
|
||
private class CarActor : ICarActor | ||
Check failure on line 32 in src/SuperFluid.Tests/SourceGenerators/GeneratedBuilderTests.cs GitHub Actions / Test Project
Check failure on line 32 in src/SuperFluid.Tests/SourceGenerators/GeneratedBuilderTests.cs GitHub Actions / Test Project
|
||
{ | ||
private readonly List<string> _states = []; | ||
|
||
public ICanUnlockOrBuild Lock() | ||
{ | ||
_states.Add("Lock"); | ||
return this; | ||
} | ||
|
||
public ICanStartOrExit Enter() | ||
{ | ||
_states.Add("Enter"); | ||
return this; | ||
} | ||
|
||
ICanLockOrEnter ICanUnlockOrBuild.Unlock() | ||
Check failure on line 48 in src/SuperFluid.Tests/SourceGenerators/GeneratedBuilderTests.cs GitHub Actions / Test Project
|
||
{ | ||
_states.Add("Unlock"); | ||
return this; | ||
} | ||
|
||
public static ICanUnlock Initialize() | ||
{ | ||
return new CarActor(); | ||
} | ||
|
||
public string Build(string colour) | ||
{ | ||
_states.Add($"Build {colour}"); | ||
return string.Join(" ", _states); | ||
} | ||
|
||
public ICanStop Start(int speed, string direction) | ||
{ | ||
_states.Add($"Start {speed} {direction}"); | ||
return this; | ||
} | ||
|
||
public ICanLockOrEnter Exit() | ||
{ | ||
_states.Add("Exit"); | ||
return this; | ||
} | ||
|
||
public ICanStartOrExit Stop() | ||
{ | ||
_states.Add("Stop"); | ||
return this; | ||
} | ||
|
||
ICanLockOrEnter ICanUnlock.Unlock() | ||
{ | ||
_states.Add("Unlock"); | ||
return this; | ||
} | ||
} | ||
} |
This file contains 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