Skip to content

Commit db35b85

Browse files
committed
Add unit tests
1 parent e1e53aa commit db35b85

20 files changed

Lines changed: 354 additions & 31 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,4 @@ FodyWeavers.xsd
396396

397397
# JetBrains Rider
398398
*.sln.iml
399+
src/OrchardCoreContrib.Testing.Web/Localization

OrchardCoreContrib.Testing.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCoreContrib.Testing.
1313
EndProject
1414
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCoreContrib.Testing", "src\OrchardCoreContrib.Testing\OrchardCoreContrib.Testing.csproj", "{60B9E226-55FF-4B5C-BFFE-57A14DE6CC58}"
1515
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCoreContrib.Testing.Web", "src\OrchardCoreContrib.Testing.Web\OrchardCoreContrib.Testing.Web.csproj", "{A0FE9046-5B92-4C73-AB51-33CE15F14917}"
17+
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCoreContrib.Testing.Tests", "test\OrchardCoreContrib.Testing.Tests\OrchardCoreContrib.Testing.Tests.csproj", "{F0C2E52D-4412-4A18-B0F7-FD99F85F192C}"
19+
EndProject
1620
Global
1721
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1822
Debug|Any CPU = Debug|Any CPU
@@ -31,6 +35,14 @@ Global
3135
{60B9E226-55FF-4B5C-BFFE-57A14DE6CC58}.Debug|Any CPU.Build.0 = Debug|Any CPU
3236
{60B9E226-55FF-4B5C-BFFE-57A14DE6CC58}.Release|Any CPU.ActiveCfg = Release|Any CPU
3337
{60B9E226-55FF-4B5C-BFFE-57A14DE6CC58}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{A0FE9046-5B92-4C73-AB51-33CE15F14917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{A0FE9046-5B92-4C73-AB51-33CE15F14917}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{A0FE9046-5B92-4C73-AB51-33CE15F14917}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{A0FE9046-5B92-4C73-AB51-33CE15F14917}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{F0C2E52D-4412-4A18-B0F7-FD99F85F192C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{F0C2E52D-4412-4A18-B0F7-FD99F85F192C}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{F0C2E52D-4412-4A18-B0F7-FD99F85F192C}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{F0C2E52D-4412-4A18-B0F7-FD99F85F192C}.Release|Any CPU.Build.0 = Release|Any CPU
3446
EndGlobalSection
3547
GlobalSection(SolutionProperties) = preSolution
3648
HideSolutionNode = FALSE
@@ -39,6 +51,8 @@ Global
3951
{A9E5A40B-78F8-4F02-9E73-C74F395B5BBD} = {20F306B8-D63F-4A61-AF6E-64B4E0918E30}
4052
{985F5AD6-8C18-4E63-A35C-A5673F237A4D} = {27507B03-7D7C-492D-92A4-FF5812B9D7DB}
4153
{60B9E226-55FF-4B5C-BFFE-57A14DE6CC58} = {20F306B8-D63F-4A61-AF6E-64B4E0918E30}
54+
{A0FE9046-5B92-4C73-AB51-33CE15F14917} = {20F306B8-D63F-4A61-AF6E-64B4E0918E30}
55+
{F0C2E52D-4412-4A18-B0F7-FD99F85F192C} = {27507B03-7D7C-492D-92A4-FF5812B9D7DB}
4256
EndGlobalSection
4357
GlobalSection(ExtensibilityGlobals) = postSolution
4458
SolutionGuid = {DD153137-BF4D-4977-A4D7-4C448D23479A}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
autoReload="true"
5+
internalLogLevel="Warn"
6+
internalLogFile="${var:configDir}/logs/internal-nlog.txt">
7+
8+
<extensions>
9+
<add assembly="NLog.Web.AspNetCore"/>
10+
<add assembly="OrchardCore.Logging.NLog"/>
11+
</extensions>
12+
13+
<targets>
14+
<!-- file target -->
15+
<target xsi:type="File" name="file"
16+
fileName="${var:configDir}/logs/orchard-log-${shortdate}.log"
17+
layout="${longdate}|${orchard-tenant-name}|${aspnet-traceidentifier}|${event-properties:item=EventId}|${logger}|${uppercase:${level}}|${message} ${exception:format=ToString,StackTrace}"
18+
/>
19+
20+
<!-- console target -->
21+
<target xsi:type="Console" name="console" />
22+
23+
</targets>
24+
25+
<rules>
26+
<!-- all warnings and above go to the file target -->
27+
<logger name="*" minlevel="Warn" writeTo="file" />
28+
29+
<!-- the hosting lifetime events go to the console and file targets -->
30+
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="file, console" />
31+
</rules>
32+
</nlog>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<Folder Include="wwwroot\" />
12+
<Folder Include="Localization\" />
13+
</ItemGroup>
14+
15+
<!-- Watcher include and excludes -->
16+
<ItemGroup>
17+
<Watch Include="**\*.cs" Exclude="Recipes\**;Assets\**;node_modules\**\*;**\*.js.map;obj\**\*;bin\**\*" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<PackageReference Include="OrchardCore.Logging.NLog" Version="2.2.1" />
22+
<PackageReference Include="OrchardCore.Application.Cms.Targets" Version="2.2.1" />
23+
</ItemGroup>
24+
25+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using OrchardCore.Logging;
2+
3+
var builder = WebApplication.CreateBuilder(args);
4+
5+
builder.Host.UseNLogHost();
6+
7+
builder.Services
8+
.AddOrchardCms()
9+
// // Orchard Specific Pipeline
10+
// .ConfigureServices( services => {
11+
// })
12+
// .Configure( (app, routes, services) => {
13+
// })
14+
;
15+
16+
var app = builder.Build();
17+
18+
if (!app.Environment.IsDevelopment())
19+
{
20+
app.UseExceptionHandler("/Error");
21+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
22+
app.UseHsts();
23+
}
24+
25+
app.UseHttpsRedirection();
26+
app.UseStaticFiles();
27+
28+
app.UseOrchardCore();
29+
30+
app.Run();
31+
32+
namespace OrchardCoreContrib.Testing.Web
33+
{
34+
public partial class Program;
35+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:8080",
7+
"sslPort": 44300
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"OrchardCoreContrib.Testing.Web": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"applicationUrl": "https://localhost:5001;http://localhost:5000",
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
}
25+
}
26+
}
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"IncludeScopes": false,
4+
"LogLevel": {
5+
"Default": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
��

src/OrchardCoreContrib.Testing/AgencySiteContext.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/OrchardCoreContrib.Testing/BlogSiteContext.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)