ndb tester improvements

messaging
Tudor Stanciu 2022-01-22 00:48:34 +02:00
parent 5bb9145443
commit 6d78fe4a09
9 changed files with 79 additions and 7 deletions

View File

@ -9,8 +9,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\infrastructure\NDB.Infrastructure.DatabaseMigration\NDB.Infrastructure.DatabaseMigration.csproj" />
<ProjectReference Include="..\NDB.Extensions.Swagger\NDB.Extensions.Swagger.csproj" />
<ProjectReference Include="..\NDB.Security.Authentication.Identity\NDB.Security.Authentication.Identity.csproj" />
<ProjectReference Include="..\test\NDB.Test.Application\NDB.Test.Application.csproj" />
</ItemGroup>
</Project>

View File

@ -1,11 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
namespace NDB.Test.Api
{
@ -13,6 +9,10 @@ namespace NDB.Test.Api
{
public static void Main(string[] args)
{
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
Directory.SetCurrentDirectory(pathToContentRoot);
CreateHostBuilder(args).Build().Run();
}

View File

@ -6,6 +6,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using NDB.Extensions.Swagger;
using NDB.Extensions.Swagger.Constants;
using NDB.Infrastructure.DatabaseMigration;
using NDB.Test.Api.Extensions;
namespace NDB.Test.Api
@ -27,6 +28,8 @@ namespace NDB.Test.Api
services.AddControllers();
services.AddSwagger("NDB.Test.Api", AuthorizationType.InhouseIdentity);
services.AddMigration();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -49,6 +52,8 @@ namespace NDB.Test.Api
{
endpoints.MapControllers();
});
app.UseMigration();
}
}
}

View File

@ -1,4 +1,7 @@
{
"ConnectionStrings": {
"DatabaseConnection": "Data Source={Workspace}\\TesterDb.db"
},
"Logging": {
"LogLevel": {
"Default": "Information",

View File

@ -58,7 +58,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCEE458E-0
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NDB.Test.Api", "NDB.Test.Api\NDB.Test.Api.csproj", "{F717BE3D-F5F4-4D99-B96D-D0A23E8BED01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDB.Infrastructure.DatabaseMigration", "infrastructure\NDB.Infrastructure.DatabaseMigration\NDB.Infrastructure.DatabaseMigration.csproj", "{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NDB.Infrastructure.DatabaseMigration", "infrastructure\NDB.Infrastructure.DatabaseMigration\NDB.Infrastructure.DatabaseMigration.csproj", "{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDB.Test.Application", "test\NDB.Test.Application\NDB.Test.Application.csproj", "{87C39FDC-2BCF-445F-BF61-0DFB28FC1B26}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -110,6 +112,10 @@ Global
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}.Release|Any CPU.Build.0 = Release|Any CPU
{87C39FDC-2BCF-445F-BF61-0DFB28FC1B26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87C39FDC-2BCF-445F-BF61-0DFB28FC1B26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87C39FDC-2BCF-445F-BF61-0DFB28FC1B26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87C39FDC-2BCF-445F-BF61-0DFB28FC1B26}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -138,6 +144,7 @@ Global
{CCEE458E-02A8-42FD-8F5F-A35481A23303} = {E0202271-4E92-4DB8-900D-B5FD745B9278}
{F717BE3D-F5F4-4D99-B96D-D0A23E8BED01} = {CCEE458E-02A8-42FD-8F5F-A35481A23303}
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB} = {1C1D634E-06CC-4707-9564-E31A76F27D9E}
{87C39FDC-2BCF-445F-BF61-0DFB28FC1B26} = {CCEE458E-02A8-42FD-8F5F-A35481A23303}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87541BAB-3FAC-4ADB-A7FB-8228DA87843D}

View File

@ -0,0 +1,8 @@
using System;
namespace NDB.Test.Application
{
public class Class1
{
}
}

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Update="Scripts\1.0.0\01.Create table MimeType.sql">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Scripts\1.0.1\04.Create table Settings.sql">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
CREATE TABLE "MimeType" (
"MimeTypeId" INTEGER NOT NULL,
"MimeTypeCode" TEXT NOT NULL UNIQUE,
"MimeTypeName" TEXT NOT NULL,
CONSTRAINT "PK_MimeType" PRIMARY KEY("MimeTypeId" AUTOINCREMENT)
);
INSERT INTO MimeType(MimeTypeId, MimeTypeCode, MimeTypeName)
SELECT 1, '.jpeg', 'image/jpeg' UNION
SELECT 2, '.jpg','image/jpeg' UNION
SELECT 3, '.png','image/png' UNION
SELECT 4, '.bmp','image/bmp' UNION
SELECT 5, '.gif','image/gif' UNION
SELECT 6, '.tif','image/tiff' UNION
SELECT 7, '.tiff','image/tiff' UNION
SELECT 8, '.xml','text/xml' UNION
SELECT 9, '.txt','text/plain' UNION
SELECT 10, '.json','application/json';

View File

@ -0,0 +1,13 @@
CREATE TABLE "Settings" (
"Id" INTEGER NOT NULL,
"Code" TEXT NOT NULL UNIQUE,
"Name" TEXT NOT NULL,
"Description" TEXT,
"Context" TEXT NOT NULL
CONSTRAINT "PK_Settings" PRIMARY KEY("Id" AUTOINCREMENT)
);
INSERT INTO Settings(Id, Code, Name, Context)
SELECT 1, 'THEME', 'Application theme', 'USER' UNION
SELECT 2, 'LANGUAGE', 'Application language', 'USER' UNION
SELECT 3, 'NOTIFICATIONS_POSITION', 'Notifications position', 'USER'