Merged PR 211: Add csharp classes to SVGLayoutDesigner and add tests
This commit is contained in:
parent
24e47ae240
commit
f74af69291
40 changed files with 1346 additions and 13 deletions
155
csharp/SVGLDLibs/SVGLDWebAPI/Controllers/SVGLDController.cs
Normal file
155
csharp/SVGLDLibs/SVGLDWebAPI/Controllers/SVGLDController.cs
Normal file
|
@ -0,0 +1,155 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVGLDLibs.Models;
|
||||
|
||||
namespace SVGLDWebAPI.Controllers;
|
||||
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]/[Action]")]
|
||||
public class SVGLDController : ControllerBase
|
||||
{
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.ActionContainerModel))]
|
||||
public bool ActionContainerModel(ActionContainerModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.AddingBehaviorEnumModel))]
|
||||
public bool AddingBehaviorEnumModel(AddingBehaviorEnumModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.ApplicationStateModel))]
|
||||
public bool ApplicationStateModel(ApplicationStateModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.AvailableContainerModel))]
|
||||
public bool AvailableContainerModel(AvailableContainerModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.AvailableSymbolModel))]
|
||||
public bool AvailableSymbolModel(AvailableSymbolModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.Category))]
|
||||
public bool Category(Category model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.ConfigurationResponseModel))]
|
||||
public bool ConfigurationResponseModel(ConfigurationResponseModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.ContainerModel))]
|
||||
public bool ContainerModel(ContainerModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.ContainerProperties))]
|
||||
public bool ContainerProperties(ContainerProperties model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.CSSStyle))]
|
||||
public bool CSSStyle(CSSStyle model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.GetFeedbackRequest))]
|
||||
public bool GetFeedbackRequest(GetFeedbackRequest model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.GetFeedbackResponse))]
|
||||
public bool GetFeedbackResponse(GetFeedbackResponse model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.ImageModel))]
|
||||
public bool ImageModel(ImageModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.Margin))]
|
||||
public bool Margin(Margin model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.Message))]
|
||||
public bool Message(Message model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.MessageType))]
|
||||
public bool MessageType(MessageType model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.Orientation))]
|
||||
public bool Orientation(Orientation model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.Pattern))]
|
||||
public bool Pattern(Pattern model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.PointModel))]
|
||||
public bool PointModel(PointModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.Position))]
|
||||
public bool Position(Position model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.PositionReferenceEnumModel))]
|
||||
public bool PositionReferenceEnumModel(PositionReferenceEnumModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.SetContainerListRequest))]
|
||||
public bool SetContainerListRequest(SetContainerListRequest model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.SetContainerListResponse))]
|
||||
public bool SetContainerListResponse(SetContainerListResponse model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpPost(Name = nameof(SVGLDLibs.Models.SymbolModel))]
|
||||
public bool SymbolModel(SymbolModel model)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
37
csharp/SVGLDLibs/SVGLDWebAPI/Program.cs
Normal file
37
csharp/SVGLDLibs/SVGLDWebAPI/Program.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
const string allowOrigin = "allowOrigin";
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: allowOrigin,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:3000");
|
||||
});
|
||||
});
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseCors(allowOrigin);
|
||||
|
||||
// app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
31
csharp/SVGLDLibs/SVGLDWebAPI/Properties/launchSettings.json
Normal file
31
csharp/SVGLDLibs/SVGLDWebAPI/Properties/launchSettings.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:2891",
|
||||
"sslPort": 44305
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"SVGLDWebAPI": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7280;http://localhost:5209",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
csharp/SVGLDLibs/SVGLDWebAPI/README.md
Normal file
15
csharp/SVGLDLibs/SVGLDWebAPI/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# SVGLDWebAPI
|
||||
|
||||
This project tests the serialization of C# models of SVGLayoutDesigner
|
||||
by creating an entry point for each model.
|
||||
|
||||
This project must be used in pair with the api.test.tsx from SVGLayoutDesigner nodejs project.
|
||||
|
||||
api.test.tsx will serialize each of its models accordingly to its types
|
||||
and POST to each corresponding entry point.
|
||||
|
||||
When a test is succeeding `true` will be return.
|
||||
|
||||
When a test is failing `400 Bad Request` will be returned.
|
||||
|
||||
This project does not test any logic in the models.
|
17
csharp/SVGLDLibs/SVGLDWebAPI/SVGLDWebAPI.csproj
Normal file
17
csharp/SVGLDLibs/SVGLDWebAPI/SVGLDWebAPI.csproj
Normal file
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SVGLDLibs\SVGLDLibs.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
csharp/SVGLDLibs/SVGLDWebAPI/appsettings.json
Normal file
9
csharp/SVGLDLibs/SVGLDWebAPI/appsettings.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue