diff --git a/AutomatedTestingApp.sln b/AutomatedTestingApp.sln index 1a44e55..d3eddd7 100644 --- a/AutomatedTestingApp.sln +++ b/AutomatedTestingApp.sln @@ -6,6 +6,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedTestingApp.Tests", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{E59DE8FE-A6EE-40B3-AD51-442955494864}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedTestingApp.Core", "src\AutomatedTestingApp.Core\AutomatedTestingApp.Core.csproj", "{91D08566-7879-4E76-B1F8-4322167BCC28}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedTestingApp.Infrastructure", "src\AutomatedTestingApp.Infrastructure\AutomatedTestingApp.Infrastructure.csproj", "{4F09B7B7-A22A-4C27-B82F-6AEE0B222141}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,6 +24,14 @@ Global {61CB4E97-F8C4-412C-BC70-72EF359172CB}.Debug|Any CPU.Build.0 = Debug|Any CPU {61CB4E97-F8C4-412C-BC70-72EF359172CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {61CB4E97-F8C4-412C-BC70-72EF359172CB}.Release|Any CPU.Build.0 = Release|Any CPU + {91D08566-7879-4E76-B1F8-4322167BCC28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91D08566-7879-4E76-B1F8-4322167BCC28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91D08566-7879-4E76-B1F8-4322167BCC28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91D08566-7879-4E76-B1F8-4322167BCC28}.Release|Any CPU.Build.0 = Release|Any CPU + {4F09B7B7-A22A-4C27-B82F-6AEE0B222141}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F09B7B7-A22A-4C27-B82F-6AEE0B222141}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F09B7B7-A22A-4C27-B82F-6AEE0B222141}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F09B7B7-A22A-4C27-B82F-6AEE0B222141}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {61CB4E97-F8C4-412C-BC70-72EF359172CB} = {E59DE8FE-A6EE-40B3-AD51-442955494864} diff --git a/src/AutomatedTestingApp.Core/AutomatedTestingApp.Core.csproj b/src/AutomatedTestingApp.Core/AutomatedTestingApp.Core.csproj new file mode 100644 index 0000000..e3210bd --- /dev/null +++ b/src/AutomatedTestingApp.Core/AutomatedTestingApp.Core.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/src/AutomatedTestingApp.Core/Courses/Course.cs b/src/AutomatedTestingApp.Core/Courses/Course.cs new file mode 100644 index 0000000..623761f --- /dev/null +++ b/src/AutomatedTestingApp.Core/Courses/Course.cs @@ -0,0 +1,8 @@ +namespace AutomatedTestingApp.Core.Courses; + +public class Course +{ + public Guid CourseId { get; set; } + public string Name { get; set; } + public string Description { get; set; } +} \ No newline at end of file diff --git a/src/AutomatedTestingApp/Areas/Identity/Models/IdentityUser.cs b/src/AutomatedTestingApp.Core/Users/IdentityUser.cs similarity index 70% rename from src/AutomatedTestingApp/Areas/Identity/Models/IdentityUser.cs rename to src/AutomatedTestingApp.Core/Users/IdentityUser.cs index e58ab2e..dcc5f31 100644 --- a/src/AutomatedTestingApp/Areas/Identity/Models/IdentityUser.cs +++ b/src/AutomatedTestingApp.Core/Users/IdentityUser.cs @@ -1,7 +1,7 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using Microsoft.EntityFrameworkCore; -namespace AutomatedTestingApp.Areas.Identity.Models; +namespace AutomatedTestingApp.Core.Users; [Keyless] public class IdentityUser diff --git a/src/AutomatedTestingApp.Infrastructure/AutomatedTestingApp.Infrastructure.csproj b/src/AutomatedTestingApp.Infrastructure/AutomatedTestingApp.Infrastructure.csproj new file mode 100644 index 0000000..c5334e4 --- /dev/null +++ b/src/AutomatedTestingApp.Infrastructure/AutomatedTestingApp.Infrastructure.csproj @@ -0,0 +1,28 @@ + + + + net8.0 + enable + enable + + + + + + + + + PreserveNewest + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/src/AutomatedTestingApp/Data/AutomatedTestingApp.db b/src/AutomatedTestingApp.Infrastructure/Data/AutomatedTestingApp.db similarity index 100% rename from src/AutomatedTestingApp/Data/AutomatedTestingApp.db rename to src/AutomatedTestingApp.Infrastructure/Data/AutomatedTestingApp.db diff --git a/src/AutomatedTestingApp/Helpers/DataContext.cs b/src/AutomatedTestingApp.Infrastructure/DataContext.cs similarity index 71% rename from src/AutomatedTestingApp/Helpers/DataContext.cs rename to src/AutomatedTestingApp.Infrastructure/DataContext.cs index 08102f2..26cd5dd 100644 --- a/src/AutomatedTestingApp/Helpers/DataContext.cs +++ b/src/AutomatedTestingApp.Infrastructure/DataContext.cs @@ -1,7 +1,7 @@ -using AutomatedTestingApp.Areas.Identity.Models; +using AutomatedTestingApp.Core.Users; using Microsoft.EntityFrameworkCore; -namespace AutomatedTestingApp.Helpers; +namespace AutomatedTestingApp.Infrastructure; public class DataContext : DbContext { diff --git a/src/AutomatedTestingApp/Migrations/20230918081031_InitialCreate.Designer.cs b/src/AutomatedTestingApp.Infrastructure/Migrations/20230918081031_InitialCreate.Designer.cs similarity index 96% rename from src/AutomatedTestingApp/Migrations/20230918081031_InitialCreate.Designer.cs rename to src/AutomatedTestingApp.Infrastructure/Migrations/20230918081031_InitialCreate.Designer.cs index a0a5ec1..ac623c3 100644 --- a/src/AutomatedTestingApp/Migrations/20230918081031_InitialCreate.Designer.cs +++ b/src/AutomatedTestingApp.Infrastructure/Migrations/20230918081031_InitialCreate.Designer.cs @@ -1,6 +1,6 @@ // using System; -using AutomatedTestingApp.Helpers; +using AutomatedTestingApp.Infrastructure; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/src/AutomatedTestingApp/Migrations/20230918081031_InitialCreate.cs b/src/AutomatedTestingApp.Infrastructure/Migrations/20230918081031_InitialCreate.cs similarity index 100% rename from src/AutomatedTestingApp/Migrations/20230918081031_InitialCreate.cs rename to src/AutomatedTestingApp.Infrastructure/Migrations/20230918081031_InitialCreate.cs diff --git a/src/AutomatedTestingApp/Migrations/DataContextModelSnapshot.cs b/src/AutomatedTestingApp.Infrastructure/Migrations/DataContextModelSnapshot.cs similarity index 96% rename from src/AutomatedTestingApp/Migrations/DataContextModelSnapshot.cs rename to src/AutomatedTestingApp.Infrastructure/Migrations/DataContextModelSnapshot.cs index 0a67416..bcad54c 100644 --- a/src/AutomatedTestingApp/Migrations/DataContextModelSnapshot.cs +++ b/src/AutomatedTestingApp.Infrastructure/Migrations/DataContextModelSnapshot.cs @@ -1,6 +1,6 @@ // using System; -using AutomatedTestingApp.Helpers; +using AutomatedTestingApp.Infrastructure; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/src/AutomatedTestingApp/Repositories/IRepository.cs b/src/AutomatedTestingApp.Infrastructure/Repositories/IRepository.cs similarity index 87% rename from src/AutomatedTestingApp/Repositories/IRepository.cs rename to src/AutomatedTestingApp.Infrastructure/Repositories/IRepository.cs index 68ed327..d2169d9 100644 --- a/src/AutomatedTestingApp/Repositories/IRepository.cs +++ b/src/AutomatedTestingApp.Infrastructure/Repositories/IRepository.cs @@ -1,6 +1,6 @@ using System.Linq.Expressions; -namespace AutomatedTestingApp.Repositories; +namespace AutomatedTestingApp.Infrastructure.Repositories; public interface IRepository { diff --git a/src/AutomatedTestingApp/Repositories/IUnitOfWork.cs b/src/AutomatedTestingApp.Infrastructure/Repositories/IUnitOfWork.cs similarity index 71% rename from src/AutomatedTestingApp/Repositories/IUnitOfWork.cs rename to src/AutomatedTestingApp.Infrastructure/Repositories/IUnitOfWork.cs index 7534f21..d88e526 100644 --- a/src/AutomatedTestingApp/Repositories/IUnitOfWork.cs +++ b/src/AutomatedTestingApp.Infrastructure/Repositories/IUnitOfWork.cs @@ -1,4 +1,4 @@ -namespace AutomatedTestingApp.Repositories; +namespace AutomatedTestingApp.Infrastructure.Repositories; public interface IUnitOfWork { diff --git a/src/AutomatedTestingApp/Repositories/Repository.cs b/src/AutomatedTestingApp.Infrastructure/Repositories/Repository.cs similarity index 94% rename from src/AutomatedTestingApp/Repositories/Repository.cs rename to src/AutomatedTestingApp.Infrastructure/Repositories/Repository.cs index 2c310a5..9286bea 100644 --- a/src/AutomatedTestingApp/Repositories/Repository.cs +++ b/src/AutomatedTestingApp.Infrastructure/Repositories/Repository.cs @@ -1,8 +1,7 @@ using System.Linq.Expressions; -using AutomatedTestingApp.Helpers; using Microsoft.EntityFrameworkCore; -namespace AutomatedTestingApp.Repositories; +namespace AutomatedTestingApp.Infrastructure.Repositories; public class Repository : IRepository where TEntity : class { diff --git a/src/AutomatedTestingApp/Repositories/UnitOfWork.cs b/src/AutomatedTestingApp.Infrastructure/Repositories/UnitOfWork.cs similarity index 91% rename from src/AutomatedTestingApp/Repositories/UnitOfWork.cs rename to src/AutomatedTestingApp.Infrastructure/Repositories/UnitOfWork.cs index 82d8e29..d4ab297 100644 --- a/src/AutomatedTestingApp/Repositories/UnitOfWork.cs +++ b/src/AutomatedTestingApp.Infrastructure/Repositories/UnitOfWork.cs @@ -1,6 +1,4 @@ -using AutomatedTestingApp.Helpers; - -namespace AutomatedTestingApp.Repositories; +namespace AutomatedTestingApp.Infrastructure.Repositories; public class UnitOfWork : IUnitOfWork, IDisposable { diff --git a/src/AutomatedTestingApp/Areas/Identity/Controllers/AccountController.cs b/src/AutomatedTestingApp/Areas/Identity/Controllers/AccountController.cs index 5983d18..127dbb5 100644 --- a/src/AutomatedTestingApp/Areas/Identity/Controllers/AccountController.cs +++ b/src/AutomatedTestingApp/Areas/Identity/Controllers/AccountController.cs @@ -1,9 +1,9 @@ using System.Security.Claims; -using AutomatedTestingApp.Areas.Identity.Models; -using AutomatedTestingApp.Repositories; +using AutomatedTestingApp.Infrastructure.Repositories; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Mvc; +using IdentityUser = AutomatedTestingApp.Core.Users.IdentityUser; namespace AutomatedTestingApp.Areas.Identity.Controllers; diff --git a/src/AutomatedTestingApp/Areas/Identity/Views/Account/Login.cshtml b/src/AutomatedTestingApp/Areas/Identity/Views/Account/Login.cshtml index e4758da..c14ba77 100644 --- a/src/AutomatedTestingApp/Areas/Identity/Views/Account/Login.cshtml +++ b/src/AutomatedTestingApp/Areas/Identity/Views/Account/Login.cshtml @@ -1,4 +1,4 @@ -@model AutomatedTestingApp.Areas.Identity.Models.IdentityUser +@model AutomatedTestingApp.Core.Users.IdentityUser diff --git a/src/AutomatedTestingApp/AutomatedTestingApp.csproj b/src/AutomatedTestingApp/AutomatedTestingApp.csproj index 1a5d0f1..2ea9489 100644 --- a/src/AutomatedTestingApp/AutomatedTestingApp.csproj +++ b/src/AutomatedTestingApp/AutomatedTestingApp.csproj @@ -7,32 +7,24 @@ Linux - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - + <_ContentIncludedByDefault Remove="Views\Account\Index.cshtml" /> + <_ContentIncludedByDefault Remove="Views\Articles\Index.cshtml" /> - - PreserveNewest - + + - <_ContentIncludedByDefault Remove="Views\Account\Index.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Articles\Index.cshtml" /> + diff --git a/src/AutomatedTestingApp/Program.cs b/src/AutomatedTestingApp/Program.cs index eef1ef0..54d44be 100644 --- a/src/AutomatedTestingApp/Program.cs +++ b/src/AutomatedTestingApp/Program.cs @@ -1,5 +1,5 @@ -using AutomatedTestingApp.Helpers; -using AutomatedTestingApp.Repositories; +using AutomatedTestingApp.Infrastructure; +using AutomatedTestingApp.Infrastructure.Repositories; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.EntityFrameworkCore; diff --git a/src/AutomatedTestingApp/Properties/launchSettings.json b/src/AutomatedTestingApp/Properties/launchSettings.json index 9c44a31..f1e269a 100644 --- a/src/AutomatedTestingApp/Properties/launchSettings.json +++ b/src/AutomatedTestingApp/Properties/launchSettings.json @@ -15,7 +15,7 @@ "applicationUrl": "http://localhost:5142", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", - "CUSTOMCONNSTR_SQLITE": "Data/AutomatedTestingApp.db" + "CUSTOMCONNSTR_SQLITE": "../AutomatedTestingApp.Infrastructure/Data/AutomatedTestingApp.db" } }, "https": { diff --git a/tests/AutomatedTestingApp.Tests/Areas/Identity/Controllers/AccountControllerTest.cs b/tests/AutomatedTestingApp.Tests/Areas/Identity/Controllers/AccountControllerTest.cs index 43ca838..74a8640 100644 --- a/tests/AutomatedTestingApp.Tests/Areas/Identity/Controllers/AccountControllerTest.cs +++ b/tests/AutomatedTestingApp.Tests/Areas/Identity/Controllers/AccountControllerTest.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using AutomatedTestingApp.Areas.Identity.Controllers; using AutomatedTestingApp.Areas.Identity.Models; -using AutomatedTestingApp.Repositories; +using AutomatedTestingApp.Infrastructure.Repositories; using JetBrains.Annotations; using Microsoft.AspNetCore.Mvc; using Moq;