Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
netcoreplus
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
netcoreplus
Commits
92130ca9
Commit
92130ca9
authored
May 27, 2019
by
阿星Plus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web test
parent
6f3deae1
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
758 additions
and
1 deletion
+758
-1
BlogCoreModule.cs
Plus.Core.Tests/BlogCoreModule.cs
+14
-0
AppSettings.cs
Plus.Core.Tests/Configuration/AppSettings.cs
+20
-0
Post.cs
Plus.Core.Tests/Domain/Post.cs
+48
-0
Plus.Core.Tests.csproj
Plus.Core.Tests/Plus.Core.Tests.csproj
+11
-0
IPostRepository.cs
Plus.Core.Tests/Repositories/IPostRepository.cs
+9
-0
BlogDbContext.cs
Plus.EFCore.Test/BlogDbContext.cs
+44
-0
BlogDbContextProvider.cs
Plus.EFCore.Test/BlogDbContextProvider.cs
+22
-0
BlogEntityFrameworkCoreModule.cs
Plus.EFCore.Test/BlogEntityFrameworkCoreModule.cs
+34
-0
BlogRepositoryBase.cs
Plus.EFCore.Test/BlogRepositoryBase.cs
+20
-0
DbConsts.cs
Plus.EFCore.Test/DbConsts.cs
+10
-0
PostConfiguration.cs
Plus.EFCore.Test/Mappers/PostConfiguration.cs
+33
-0
Plus.EFCore.Test.csproj
Plus.EFCore.Test/Plus.EFCore.Test.csproj
+17
-0
PostRepository.cs
Plus.EFCore.Test/Repositories/PostRepository.cs
+13
-0
BlogServicesDtoModule.cs
Plus.Services.Dto.Test/BlogServicesDtoModule.cs
+15
-0
Plus.Services.Dto.Test.csproj
Plus.Services.Dto.Test/Plus.Services.Dto.Test.csproj
+13
-0
PostDto.cs
Plus.Services.Dto.Test/PostDto.cs
+47
-0
IBlogService.Post.cs
Plus.Services.Test/Blog/IBlogService.Post.cs
+10
-0
BlogService.Post.cs
Plus.Services.Test/Blog/Impl/BlogService.Post.cs
+23
-0
BlogServicesModule.cs
Plus.Services.Test/BlogServicesModule.cs
+19
-0
Plus.Services.Test.csproj
Plus.Services.Test/Plus.Services.Test.csproj
+11
-0
ServiceBase.cs
Plus.Services.Test/ServiceBase.cs
+19
-0
PostController.cs
Plus.Web.Tests/Controllers/PostController.cs
+36
-0
ValuesController.cs
Plus.Web.Tests/Controllers/ValuesController.cs
+45
-0
Plus.Web.Tests.csproj
Plus.Web.Tests/Plus.Web.Tests.csproj
+22
-0
Program.cs
Plus.Web.Tests/Program.cs
+24
-0
launchSettings.json
Plus.Web.Tests/Properties/launchSettings.json
+30
-0
Startup.cs
Plus.Web.Tests/Startup.cs
+72
-0
appsettings.Development.json
Plus.Web.Tests/appsettings.Development.json
+9
-0
appsettings.json
Plus.Web.Tests/appsettings.json
+11
-0
log4net.config
Plus.Web.Tests/log4net.config
+21
-0
Plus.sln
Plus.sln
+35
-0
Plus.csproj
src/Plus/Plus.csproj
+1
-1
No files found.
Plus.Core.Tests/BlogCoreModule.cs
0 → 100644
View file @
92130ca9
using
Plus.Modules
;
using
System.Reflection
;
namespace
Plus.Core.Tests
{
[
DependsOn
(
typeof
(
PlusLeadershipModule
))]
public
class
BlogCoreModule
:
PlusModule
{
public
override
void
Initialize
()
{
IocManager
.
RegisterAssembly
(
Assembly
.
GetExecutingAssembly
());
}
}
}
\ No newline at end of file
Plus.Core.Tests/Configuration/AppSettings.cs
0 → 100644
View file @
92130ca9
using
Microsoft.Extensions.Configuration
;
using
System.IO
;
namespace
Plus.Core.Tests.Configuration
{
public
class
AppSettings
{
private
static
readonly
IConfigurationRoot
_config
;
static
AppSettings
()
{
var
builder
=
new
ConfigurationBuilder
().
SetBasePath
(
Directory
.
GetCurrentDirectory
())
.
AddJsonFile
(
"appsettings.json"
,
true
,
true
);
_config
=
builder
.
Build
();
}
public
static
string
MySqlConnectionString
=>
_config
[
"ConnectionStrings:MySql"
];
}
}
\ No newline at end of file
Plus.Core.Tests/Domain/Post.cs
0 → 100644
View file @
92130ca9
using
Plus.Domain.Entities
;
using
System
;
namespace
Plus.Core.Tests.Domain
{
public
class
Post
:
Entity
{
/// <summary>
/// 标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 作者
/// </summary>
public
string
Author
{
get
;
set
;
}
/// <summary>
/// 来源
/// </summary>
public
string
Source
{
get
;
set
;
}
/// <summary>
/// 链接
/// </summary>
public
string
Url
{
get
;
set
;
}
/// <summary>
/// 摘要
/// </summary>
public
string
Abstract
{
get
;
set
;
}
/// <summary>
/// 内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 点击量
/// </summary>
public
int
Hits
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
?
CreationTime
{
get
;
set
;
}
}
}
\ No newline at end of file
Plus.Core.Tests/Plus.Core.Tests.csproj
0 → 100644
View file @
92130ca9
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\Plus\Plus.csproj" />
</ItemGroup>
</Project>
Plus.Core.Tests/Repositories/IPostRepository.cs
0 → 100644
View file @
92130ca9
using
Plus.Core.Tests.Domain
;
using
Plus.Domain.Repositories
;
namespace
Plus.Core.Tests.Repositories
{
public
interface
IPostRepository
:
IRepository
<
Post
,
int
>
{
}
}
\ No newline at end of file
Plus.EFCore.Test/BlogDbContext.cs
0 → 100644
View file @
92130ca9
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging.Debug
;
using
Plus.EntityFramework
;
using
Plus.Reflection
;
using
System
;
using
System.Collections.Generic
;
using
System.Reflection
;
namespace
Plus.EFCore.Test
{
public
class
BlogDbContext
:
PlusDbContext
{
private
readonly
ITypeFinder
_typeFinder
=
Plus
.
PlusEngine
.
Instance
.
Resolve
<
ITypeFinder
>();
public
BlogDbContext
(
DbContextOptions
options
)
:
base
(
options
)
{
}
protected
override
void
OnModelCreating
(
ModelBuilder
modelBuilder
)
{
base
.
OnModelCreating
(
modelBuilder
);
var
assemblies
=
new
List
<
Assembly
>
{
Assembly
.
GetExecutingAssembly
()
};
var
typesToRegister
=
_typeFinder
.
FindClassesOfType
(
typeof
(
IEntityTypeConfiguration
<>),
assemblies
);
foreach
(
var
type
in
typesToRegister
)
{
dynamic
configurationInstance
=
Activator
.
CreateInstance
(
type
);
modelBuilder
.
ApplyConfiguration
(
configurationInstance
);
}
}
protected
override
void
OnConfiguring
(
DbContextOptionsBuilder
optionsBuilder
)
{
optionsBuilder
.
UseLoggerFactory
(
new
LoggerFactory
(
new
[]
{
new
DebugLoggerProvider
()
}));
base
.
OnConfiguring
(
optionsBuilder
);
}
}
}
\ No newline at end of file
Plus.EFCore.Test/BlogDbContextProvider.cs
0 → 100644
View file @
92130ca9
using
Plus.Dependency
;
using
Plus.Domain.Uow
;
using
Plus.EntityFramework
;
using
Plus.EntityFramework.Uow
;
namespace
Plus.EFCore.Test
{
public
class
BlogDbContextProvider
:
IDbContextProvider
<
BlogDbContext
>,
ITransientDependency
{
private
readonly
ICurrentUnitOfWorkProvider
_currentUnitOfWorkProvider
;
public
BlogDbContextProvider
(
ICurrentUnitOfWorkProvider
currentUnitOfWorkProvider
)
{
_currentUnitOfWorkProvider
=
currentUnitOfWorkProvider
;
}
public
BlogDbContext
GetDbContext
()
{
return
((
EfCoreUnitOfWork
)
_currentUnitOfWorkProvider
.
Current
).
GetDbContext
<
BlogDbContext
>();
}
}
}
\ No newline at end of file
Plus.EFCore.Test/BlogEntityFrameworkCoreModule.cs
0 → 100644
View file @
92130ca9
using
Castle.MicroKernel.Registration
;
using
Microsoft.EntityFrameworkCore
;
using
Plus.Core.Tests
;
using
Plus.Core.Tests.Configuration
;
using
Plus.EntityFramework
;
using
Plus.Modules
;
namespace
Plus.EFCore.Test
{
[
DependsOn
(
typeof
(
BlogCoreModule
),
typeof
(
PlusEntityFrameworkModule
)
)]
public
class
BlogEntityFrameworkCoreModule
:
PlusModule
{
public
override
void
PreInitialize
()
{
var
builder
=
new
DbContextOptionsBuilder
<
BlogDbContext
>();
builder
.
UseMySql
(
AppSettings
.
MySqlConnectionString
);
IocManager
.
IocContainer
.
Register
(
Component
.
For
<
DbContextOptions
<
BlogDbContext
>>()
.
Instance
(
builder
.
Options
)
.
LifestyleSingleton
()
);
}
public
override
void
Initialize
()
{
IocManager
.
RegisterAssembly
(
typeof
(
BlogEntityFrameworkCoreModule
).
GetAssembly
());
}
}
}
\ No newline at end of file
Plus.EFCore.Test/BlogRepositoryBase.cs
0 → 100644
View file @
92130ca9
using
Plus.Domain.Entities
;
using
Plus.EntityFramework
;
using
Plus.EntityFramework.Repositories
;
namespace
Plus.EFCore.Test
{
public
abstract
class
BlogRepositoryBase
<
TEntity
,
TPrimaryKey
>
:
EfCoreRepositoryBase
<
BlogDbContext
,
TEntity
,
TPrimaryKey
>
where
TEntity
:
class
,
IEntity
<
TPrimaryKey
>
{
public
BlogRepositoryBase
(
IDbContextProvider
<
BlogDbContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
}
public
abstract
class
BlogRepositoryBase
<
TEntity
>
:
EfCoreRepositoryBase
<
BlogDbContext
,
TEntity
,
int
>
where
TEntity
:
class
,
IEntity
<
int
>,
new
()
{
public
BlogRepositoryBase
(
IDbContextProvider
<
BlogDbContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
}
}
\ No newline at end of file
Plus.EFCore.Test/DbConsts.cs
0 → 100644
View file @
92130ca9
namespace
Plus.EFCore.Test
{
public
class
DbConsts
{
public
class
DbTableName
{
public
const
string
Posts
=
"posts"
;
}
}
}
\ No newline at end of file
Plus.EFCore.Test/Mappers/PostConfiguration.cs
0 → 100644
View file @
92130ca9
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
Plus.Core.Tests.Domain
;
namespace
Plus.EFCore.Test.Mappers
{
public
class
PostConfiguration
:
IEntityTypeConfiguration
<
Post
>
{
public
void
Configure
(
EntityTypeBuilder
<
Post
>
builder
)
{
builder
.
HasKey
(
x
=>
x
.
Id
);
builder
.
Property
(
x
=>
x
.
Id
).
ValueGeneratedOnAdd
();
builder
.
Property
(
x
=>
x
.
Title
).
HasMaxLength
(
100
).
IsFixedLength
().
IsRequired
();
builder
.
Property
(
x
=>
x
.
Author
).
HasMaxLength
(
10
).
IsFixedLength
().
IsRequired
();
builder
.
Property
(
x
=>
x
.
Source
).
HasMaxLength
(
20
).
IsFixedLength
().
IsRequired
();
builder
.
Property
(
x
=>
x
.
Url
).
HasMaxLength
(
100
).
IsFixedLength
().
IsRequired
();
builder
.
Property
(
x
=>
x
.
Abstract
).
HasMaxLength
(
200
).
IsFixedLength
().
IsRequired
();
builder
.
Property
(
x
=>
x
.
Content
).
HasColumnType
(
"longtext"
).
IsRequired
();
builder
.
Property
(
x
=>
x
.
Hits
).
HasDefaultValue
(
0
);
builder
.
Property
(
x
=>
x
.
CreationTime
).
HasColumnType
(
"datetime"
);
builder
.
ToTable
(
DbConsts
.
DbTableName
.
Posts
);
}
}
}
\ No newline at end of file
Plus.EFCore.Test/Plus.EFCore.Test.csproj
0 → 100644
View file @
92130ca9
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Plus.Core.Tests\Plus.Core.Tests.csproj" />
<ProjectReference Include="..\src\Plus.EntityFramework\Plus.EntityFramework.csproj" />
</ItemGroup>
</Project>
Plus.EFCore.Test/Repositories/PostRepository.cs
0 → 100644
View file @
92130ca9
using
Plus.Core.Tests.Domain
;
using
Plus.Core.Tests.Repositories
;
using
Plus.EntityFramework
;
namespace
Plus.EFCore.Test.Repositories
{
public
class
PostRepository
:
BlogRepositoryBase
<
Post
>,
IPostRepository
{
public
PostRepository
(
IDbContextProvider
<
BlogDbContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
}
}
\ No newline at end of file
Plus.Services.Dto.Test/BlogServicesDtoModule.cs
0 → 100644
View file @
92130ca9
using
Plus.AutoMapper
;
using
Plus.Modules
;
using
System.Reflection
;
namespace
Plus.Services.Dto.Test
{
[
DependsOn
(
typeof
(
PluseAutoMapperModule
))]
public
class
BlogServicesDtoModule
:
PlusModule
{
public
override
void
Initialize
()
{
IocManager
.
RegisterAssembly
(
Assembly
.
GetExecutingAssembly
());
}
}
}
\ No newline at end of file
Plus.Services.Dto.Test/Plus.Services.Dto.Test.csproj
0 → 100644
View file @
92130ca9
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Plus.Core.Tests\Plus.Core.Tests.csproj" />
<ProjectReference Include="..\src\Plus.AutoMapper\Plus.AutoMapper.csproj" />
<ProjectReference Include="..\src\Plus\Plus.csproj" />
</ItemGroup>
</Project>
Plus.Services.Dto.Test/PostDto.cs
0 → 100644
View file @
92130ca9
using
System
;
namespace
Plus.Services.Dto.Test
{
public
class
PostDto
{
/// <summary>
/// 标题
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 作者
/// </summary>
public
string
Author
{
get
;
set
;
}
/// <summary>
/// 来源
/// </summary>
public
string
Source
{
get
;
set
;
}
/// <summary>
/// 链接
/// </summary>
public
string
Url
{
get
;
set
;
}
/// <summary>
/// 摘要
/// </summary>
public
string
Abstract
{
get
;
set
;
}
/// <summary>
/// 内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 点击量
/// </summary>
public
int
Hits
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
?
CreationTime
{
get
;
set
;
}
}
}
\ No newline at end of file
Plus.Services.Test/Blog/IBlogService.Post.cs
0 → 100644
View file @
92130ca9
using
Plus.Services.Dto.Test
;
using
System.Threading.Tasks
;
namespace
Plus.Services.Test.Blog
{
public
partial
interface
IBlogService
{
Task
<
PostDto
>
Get
(
int
id
);
}
}
\ No newline at end of file
Plus.Services.Test/Blog/Impl/BlogService.Post.cs
0 → 100644
View file @
92130ca9
using
Plus.AutoMapper
;
using
Plus.Core.Tests.Repositories
;
using
Plus.Services.Dto.Test
;
using
System.Threading.Tasks
;
namespace
Plus.Services.Test.Blog.Impl
{
public
partial
class
BlogService
:
ServiceBase
,
IBlogService
{
private
readonly
IPostRepository
_postRepository
;
public
BlogService
(
IPostRepository
postRepository
)
{
_postRepository
=
postRepository
;
}
public
async
Task
<
PostDto
>
Get
(
int
id
)
{
var
entity
=
await
_postRepository
.
GetAsync
(
id
);
return
entity
.
MapTo
<
PostDto
>();
}
}
}
\ No newline at end of file
Plus.Services.Test/BlogServicesModule.cs
0 → 100644
View file @
92130ca9
using
Plus.AutoMapper
;
using
Plus.Modules
;
using
Plus.Services.Dto.Test
;
using
System.Reflection
;
namespace
Plus.Services.Test
{
[
DependsOn
(
typeof
(
PluseAutoMapperModule
),
typeof
(
BlogServicesDtoModule
)
)]
public
class
BlogServicesModule
:
PlusModule
{
public
override
void
Initialize
()
{
IocManager
.
RegisterAssembly
(
Assembly
.
GetExecutingAssembly
());
}
}
}
\ No newline at end of file
Plus.Services.Test/Plus.Services.Test.csproj
0 → 100644
View file @
92130ca9
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Plus.Services.Dto.Test\Plus.Services.Dto.Test.csproj" />
</ItemGroup>
</Project>
Plus.Services.Test/ServiceBase.cs
0 → 100644
View file @
92130ca9
using
Plus.Domain.Uow
;
using
Plus.Event.Bus
;
using
Plus.Reflection
;
namespace
Plus.Services.Test
{
public
abstract
class
ServiceBase
:
ApplicationServiceBase
{
public
EventBus
EventBus
=>
EventBus
.
Default
;
public
IUnitOfWorkManager
UnitOfWorkManager
;
public
ITypeFinder
TypeFinder
;
protected
ServiceBase
()
{
UnitOfWorkManager
=
PlusEngine
.
Instance
.
Resolve
<
IUnitOfWorkManager
>();
TypeFinder
=
PlusEngine
.
Instance
.
Resolve
<
ITypeFinder
>();
}
}
}
\ No newline at end of file
Plus.Web.Tests/Controllers/PostController.cs
0 → 100644
View file @
92130ca9
using
Microsoft.AspNetCore.Mvc
;
using
Plus.Services.Dto.Test
;
using
Plus.Services.Test.Blog
;
using
Plus.WebApi
;
using
System.Threading.Tasks
;
namespace
Plus.Web.Tests.Controllers
{
[
Route
(
"api/[controller]"
)]
[
ApiController
]
public
class
PostController
:
ControllerBase
{
private
readonly
IBlogService
_blogService
;
public
PostController
()
{
_blogService
=
PlusEngine
.
Instance
.
Resolve
<
IBlogService
>();
}
/// <summary>
/// Get
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[
HttpGet
]
[
Route
(
"Get"
)]
public
async
Task
<
Response
<
PostDto
>>
Get
(
int
id
)
{
var
response
=
new
Response
<
PostDto
>
{
Result
=
await
_blogService
.
Get
(
id
)
};
return
response
;
}
}
}
\ No newline at end of file
Plus.Web.Tests/Controllers/ValuesController.cs
0 → 100644
View file @
92130ca9
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
namespace
Plus.Web.Tests.Controllers
{
[
Route
(
"api/[controller]"
)]
[
ApiController
]
public
class
ValuesController
:
ControllerBase
{
// GET api/values
[
HttpGet
]
public
ActionResult
<
IEnumerable
<
string
>>
Get
()
{
return
new
string
[]
{
"value1"
,
"value2"
};
}
// GET api/values/5
[
HttpGet
(
"{id}"
)]
public
ActionResult
<
string
>
Get
(
int
id
)
{
return
"value"
;
}
// POST api/values
[
HttpPost
]
public
void
Post
([
FromBody
]
string
value
)
{
}
// PUT api/values/5
[
HttpPut
(
"{id}"
)]
public
void
Put
(
int
id
,
[
FromBody
]
string
value
)
{
}
// DELETE api/values/5
[
HttpDelete
(
"{id}"
)]
public
void
Delete
(
int
id
)
{
}
}
}
Plus.Web.Tests/Plus.Web.Tests.csproj
0 → 100644
View file @
92130ca9
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Plus.Core.Tests\Plus.Core.Tests.csproj" />
<ProjectReference Include="..\Plus.EFCore.Test\Plus.EFCore.Test.csproj" />
<ProjectReference Include="..\Plus.Services.Test\Plus.Services.Test.csproj" />
<ProjectReference Include="..\src\Plus.Extensions.Serialization\Plus.Extensions.Serialization.csproj" />
<ProjectReference Include="..\src\Plus.Log4Net\Plus.Log4Net.csproj" />
</ItemGroup>
</Project>
Plus.Web.Tests/Program.cs
0 → 100644
View file @
92130ca9
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Logging
;
namespace
Plus.Web.Tests
{
public
class
Program
{
public
static
void
Main
(
string
[]
args
)
{
CreateWebHostBuilder
(
args
).
Build
().
Run
();
}
public
static
IWebHostBuilder
CreateWebHostBuilder
(
string
[]
args
)
=>
WebHost
.
CreateDefaultBuilder
(
args
)
.
UseStartup
<
Startup
>();
}
}
Plus.Web.Tests/Properties/launchSettings.json
0 → 100644
View file @
92130ca9
{
"$schema"
:
"http://json.schemastore.org/launchsettings.json"
,
"iisSettings"
:
{
"windowsAuthentication"
:
false
,
"anonymousAuthentication"
:
true
,
"iisExpress"
:
{
"applicationUrl"
:
"http://localhost:64222"
,
"sslPort"
:
44320
}
},
"profiles"
:
{
"IIS Express"
:
{
"commandName"
:
"IISExpress"
,
"launchBrowser"
:
true
,
"launchUrl"
:
"api/values"
,
"environmentVariables"
:
{
"ASPNETCORE_ENVIRONMENT"
:
"Development"
}
},
"Plus.Web.Tests"
:
{
"commandName"
:
"Project"
,
"launchBrowser"
:
true
,
"launchUrl"
:
"api/values"
,
"applicationUrl"
:
"https://localhost:5001;http://localhost:5000"
,
"environmentVariables"
:
{
"ASPNETCORE_ENVIRONMENT"
:
"Development"
}
}
}
}
\ No newline at end of file
Plus.Web.Tests/Startup.cs
0 → 100644
View file @
92130ca9
using
Castle.Facilities.Logging
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Plus.Core.Tests
;
using
Plus.Dependency
;
using
Plus.EFCore.Test
;
using
Plus.Log4Net
;
using
Plus.Modules
;
using
Plus.Services.Dto.Test
;
using
Plus.Services.Test
;
using
System.Reflection
;
namespace
Plus.Web.Tests
{
public
class
Startup
{
public
Startup
(
IConfiguration
configuration
)
{
Configuration
=
configuration
;
}
public
IConfiguration
Configuration
{
get
;
}
// This method gets called by the runtime. Use this method to add services to the container.
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddMvc
().
SetCompatibilityVersion
(
CompatibilityVersion
.
Version_2_2
);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IHostingEnvironment
env
)
{
if
(
env
.
IsDevelopment
())
{
app
.
UseDeveloperExceptionPage
();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app
.
UseHsts
();
}
app
.
UseHttpsRedirection
();
app
.
UseMvc
();
PlusStarter
.
Create
<
BlogWebModule
>(
options
=>
{
options
.
IocManager
.
IocContainer
.
AddFacility
<
LoggingFacility
>(
x
=>
x
.
UseLog4Net
()
.
WithConfig
(
"log4net.config"
));
}).
Initialize
();
}
}
[
DependsOn
(
typeof
(
BlogCoreModule
),
typeof
(
BlogServicesModule
),
typeof
(
BlogServicesDtoModule
),
typeof
(
BlogEntityFrameworkCoreModule
)
)]
internal
class
BlogWebModule
:
PlusModule
{
public
override
void
Initialize
()
{
IocManager
.
RegisterAssembly
(
Assembly
.
GetExecutingAssembly
());
}
}
}
\ No newline at end of file
Plus.Web.Tests/appsettings.Development.json
0 → 100644
View file @
92130ca9
{
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Debug"
,
"System"
:
"Information"
,
"Microsoft"
:
"Information"
}
}
}
Plus.Web.Tests/appsettings.json
0 → 100644
View file @
92130ca9
{
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Warning"
}
},
"AllowedHosts"
:
"*"
,
"ConnectionStrings"
:
{
"MySql"
:
"Server=localhost;User Id=root;Password=123456;Database=meowv_blog"
}
}
\ No newline at end of file
Plus.Web.Tests/log4net.config
0 → 100644
View file @
92130ca9
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
log4net
>
<
appender
name
=
"RollingFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"Logs/Logs.log"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Size"
/>
<
maxSizeRollBackups
value
=
"10"
/>
<
maximumFileSize
value
=
"10000KB"
/>
<
staticLogFileName
value
=
"true"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"%-5level %date [%-5.5thread] %-40.40logger - %message%newline"
/>
</
layout
>
</
appender
>
<
root
>
<
appender
-
ref
ref
=
"RollingFileAppender"
/>
<
level
value
=
"DEBUG"
/>
</
root
>
<
logger
>
<
level
value
=
"WARN"
/>
</
logger
>
</
log4net
>
\ No newline at end of file
Plus.sln
View file @
92130ca9
...
...
@@ -31,6 +31,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plus.RedisCache", "src\Plus
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plus.Extensions.Serialization", "src\Plus.Extensions.Serialization\Plus.Extensions.Serialization.csproj", "{209BF4EB-311F-45AD-AED6-F314A49D83C7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plus.Web.Tests", "Plus.Web.Tests\Plus.Web.Tests.csproj", "{879A21A2-38A9-45C9-89C1-6BB7709C4F0B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plus.Core.Tests", "Plus.Core.Tests\Plus.Core.Tests.csproj", "{1017D21C-DE53-4791-8624-7727FFD73FD0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plus.EFCore.Test", "Plus.EFCore.Test\Plus.EFCore.Test.csproj", "{4CF853EC-99EC-4441-B086-9EA2C761DB03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plus.Services.Test", "Plus.Services.Test\Plus.Services.Test.csproj", "{D27671BF-7E67-4559-9DA6-E4AD418C3E7C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plus.Services.Dto.Test", "Plus.Services.Dto.Test\Plus.Services.Dto.Test.csproj", "{0F6DE8F7-14C0-4205-B14D-10DA2FEEB9D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -69,6 +79,26 @@ Global
{209BF4EB-311F-45AD-AED6-F314A49D83C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{209BF4EB-311F-45AD-AED6-F314A49D83C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{209BF4EB-311F-45AD-AED6-F314A49D83C7}.Release|Any CPU.Build.0 = Release|Any CPU
{879A21A2-38A9-45C9-89C1-6BB7709C4F0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{879A21A2-38A9-45C9-89C1-6BB7709C4F0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{879A21A2-38A9-45C9-89C1-6BB7709C4F0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{879A21A2-38A9-45C9-89C1-6BB7709C4F0B}.Release|Any CPU.Build.0 = Release|Any CPU
{1017D21C-DE53-4791-8624-7727FFD73FD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1017D21C-DE53-4791-8624-7727FFD73FD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1017D21C-DE53-4791-8624-7727FFD73FD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1017D21C-DE53-4791-8624-7727FFD73FD0}.Release|Any CPU.Build.0 = Release|Any CPU
{4CF853EC-99EC-4441-B086-9EA2C761DB03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CF853EC-99EC-4441-B086-9EA2C761DB03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CF853EC-99EC-4441-B086-9EA2C761DB03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CF853EC-99EC-4441-B086-9EA2C761DB03}.Release|Any CPU.Build.0 = Release|Any CPU
{D27671BF-7E67-4559-9DA6-E4AD418C3E7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D27671BF-7E67-4559-9DA6-E4AD418C3E7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D27671BF-7E67-4559-9DA6-E4AD418C3E7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D27671BF-7E67-4559-9DA6-E4AD418C3E7C}.Release|Any CPU.Build.0 = Release|Any CPU
{0F6DE8F7-14C0-4205-B14D-10DA2FEEB9D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F6DE8F7-14C0-4205-B14D-10DA2FEEB9D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F6DE8F7-14C0-4205-B14D-10DA2FEEB9D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F6DE8F7-14C0-4205-B14D-10DA2FEEB9D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
@@ -82,6 +112,11 @@ Global
{289760B5-2E69-4D9F-8F1F-2D80EA1FC36D} = {CC63505F-AC28-4DCE-93F6-82062FA5EDC3}
{BBCB7D18-8BA5-461A-B3B2-3E9A79EDA6FB} = {CC63505F-AC28-4DCE-93F6-82062FA5EDC3}
{209BF4EB-311F-45AD-AED6-F314A49D83C7} = {CC63505F-AC28-4DCE-93F6-82062FA5EDC3}
{879A21A2-38A9-45C9-89C1-6BB7709C4F0B} = {AD27338E-5F7F-4C1A-9E6F-9BFED17EF75A}
{1017D21C-DE53-4791-8624-7727FFD73FD0} = {AD27338E-5F7F-4C1A-9E6F-9BFED17EF75A}
{4CF853EC-99EC-4441-B086-9EA2C761DB03} = {AD27338E-5F7F-4C1A-9E6F-9BFED17EF75A}
{D27671BF-7E67-4559-9DA6-E4AD418C3E7C} = {AD27338E-5F7F-4C1A-9E6F-9BFED17EF75A}
{0F6DE8F7-14C0-4205-B14D-10DA2FEEB9D6} = {AD27338E-5F7F-4C1A-9E6F-9BFED17EF75A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {44529F52-F5EE-4330-BB68-E09EB8B967E3}
...
...
src/Plus/Plus.csproj
View file @
92130ca9
...
...
@@ -32,7 +32,7 @@
<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.0" />
<PackageReference Include="Castle.
Windsor" Version="4.0.0
" />
<PackageReference Include="Castle.
LoggingFacility" Version="4.1.1
" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment