Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
ProjectsStatusManagement
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
hasan.bahjat
ProjectsStatusManagement
Commits
1b8283bb
Commit
1b8283bb
authored
Aug 30, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add architecture test
parent
eb28e1fd
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
266 additions
and
33 deletions
+266
-33
AssemblyReference.cs
PSManagement.Api/AssemblyReference/AssemblyReference.cs
+15
-0
DependencyInjection.cs
PSManagement.Api/DependencyInjection/DependencyInjection.cs
+3
-32
Startup.cs
PSManagement.Api/Startup.cs
+2
-0
AssemblyReference.cs
...gement.Application/AssemblyReference/AssemblyReference.cs
+15
-0
CreateProjectCommandHandler.cs
...ses/Commands/CreateProject/CreateProjectCommandHandler.cs
+3
-0
ArchitectureDomainTests.cs
PSManagement.ArchitectureTests/ArchitectureDomainTests.cs
+34
-0
ArchitectureInfrastructureServicesTests.cs
...hitectureTests/ArchitectureInfrastructureServicesTests.cs
+34
-0
ArchitectureTest.cs
PSManagement.ArchitectureTests/ArchitectureTest.cs
+18
-0
PSManagement.ArchitectureTests.csproj
...t.ArchitectureTests/PSManagement.ArchitectureTests.csproj
+29
-0
AssemblyReference.cs
PSManagement.Domain/AssemblyReference/AssemblyReference.cs
+15
-0
Project.cs
PSManagement.Domain/Projects/Entities/Project.cs
+11
-0
AssemblyReference.cs
...ucture.Persistence/AssemblyReference/AssemblyReference.cs
+15
-0
AssemblyReference.cs
...ent.Infrastructure/AssemblyReference/AssemblyReference.cs
+15
-0
DependencyInjection.cs
...t.Presentation/DependencyInjection/DependencyInjection.cs
+39
-1
CustomerMapperConfiguration.cs
...ement.Presentation/Mappers/CustomerMapperConfiguration.cs
+0
-0
EmployeeMapperConfiguration.cs
...ement.Presentation/Mappers/EmployeeMapperConfiguration.cs
+0
-0
MappersConfigurations.cs
PSManagement.Presentation/Mappers/MappersConfigurations.cs
+0
-0
ProjectMapperConfiguration.cs
...gement.Presentation/Mappers/ProjectMapperConfiguration.cs
+0
-0
ProjectsStatusManagement.sln
ProjectsStatusManagement.sln
+18
-0
No files found.
PSManagement.Api/AssemblyReference/AssemblyReference.cs
0 → 100644
View file @
1b8283bb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Api
{
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
}
PSManagement.Api/D
I
/DependencyInjection.cs
→
PSManagement.Api/D
ependencyInjection
/DependencyInjection.cs
View file @
1b8283bb
...
@@ -14,27 +14,16 @@ namespace PSManagement.Api.DI
...
@@ -14,27 +14,16 @@ namespace PSManagement.Api.DI
{
{
public
static
IServiceCollection
AddAPI
(
this
IServiceCollection
services
)
public
static
IServiceCollection
AddAPI
(
this
IServiceCollection
services
)
{
{
services
services
.
AddApiSwagger
()
.
AddApiSwagger
()
.
AddApiCors
()
.
AddApiCors
()
.
AddMapper
()
;
.
AddMyControllers
();
return
services
;
return
services
;
}
}
#
region
Configure
controllers
private
static
IServiceCollection
AddMyControllers
(
this
IServiceCollection
services
)
{
services
.
AddControllers
()
.
AddApplicationPart
(
Presentation
.
AssemblyReference
.
Assembly
);
return
services
;
}
#
endregion
Configure
controllers
#
region
Api
Docs
Swagger
#
region
Api
Docs
Swagger
private
static
IServiceCollection
AddApiSwagger
(
this
IServiceCollection
services
)
private
static
IServiceCollection
AddApiSwagger
(
this
IServiceCollection
services
)
{
{
...
@@ -99,25 +88,7 @@ namespace PSManagement.Api.DI
...
@@ -99,25 +88,7 @@ namespace PSManagement.Api.DI
}
}
#
endregion
Cors
#
endregion
Cors
#
region
Mappers
private
static
IServiceCollection
AddMapper
(
this
IServiceCollection
services
)
{
services
.
AddScoped
<
Mapper
>();
services
.
AddAutoMapper
(
cfg
=>
{
cfg
.
AddProfile
<
CustomerMapperConfiguration
>();
cfg
.
AddProfile
<
ProjectMapperConfiguration
>();
cfg
.
AddProfile
<
MappersConfigurations
>();
cfg
.
AddProfile
<
EmployeeMapperConfiguration
>();
});
return
services
;
}
#
endregion
Mappers
}
}
...
...
PSManagement.Api/Startup.cs
View file @
1b8283bb
...
@@ -28,6 +28,7 @@ namespace PSManagement.Api
...
@@ -28,6 +28,7 @@ namespace PSManagement.Api
public
IConfiguration
Configuration
{
get
;
}
public
IConfiguration
Configuration
{
get
;
}
// This method gets called by the runtime. Use this method to add services to the container.
// This method gets called by the runtime. Use this method to add services to the container.
public
void
ConfigureServices
(
IServiceCollection
services
)
public
void
ConfigureServices
(
IServiceCollection
services
)
{
{
// adding dependency injection
// adding dependency injection
...
@@ -39,6 +40,7 @@ namespace PSManagement.Api
...
@@ -39,6 +40,7 @@ namespace PSManagement.Api
.
AddInfrastructureSevices
(
Configuration
);
.
AddInfrastructureSevices
(
Configuration
);
}
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
)
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
)
{
{
...
...
PSManagement.Application/AssemblyReference/AssemblyReference.cs
0 → 100644
View file @
1b8283bb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Application
{
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
}
PSManagement.Application/Projects/UseCases/Commands/CreateProject/CreateProjectCommandHandler.cs
View file @
1b8283bb
...
@@ -40,6 +40,9 @@ namespace PSManagement.Application.Projects.UseCases.Commands.CreateProject
...
@@ -40,6 +40,9 @@ namespace PSManagement.Application.Projects.UseCases.Commands.CreateProject
return
Result
.
Invalid
(
ProjectTypesErrors
.
InvalidEntryError
);
return
Result
.
Invalid
(
ProjectTypesErrors
.
InvalidEntryError
);
}
}
//using builder from domain layer to build the project
Project
project
=
_projectBuilder
Project
project
=
_projectBuilder
.
WithProjectAggreement
(
request
.
ProjectAggreement
)
.
WithProjectAggreement
(
request
.
ProjectAggreement
)
.
WithProjectInfo
(
request
.
ProjectInfo
)
.
WithProjectInfo
(
request
.
ProjectInfo
)
...
...
PSManagement.ArchitectureTests/ArchitectureDomainTests.cs
0 → 100644
View file @
1b8283bb
using
NetArchTest.Rules
;
using
FluentAssertions
;
using
Xunit
;
namespace
PSManagement.ArchitectureTests
{
public
partial
class
ArchitectureDomainTests
:
ArchitectureTest
{
[
Fact
]
public
void
Domain_Should_Not_DependOnOtherProject
()
{
// Arrange
var
otherProject
=
new
[]
{
ApplicationNamespace
,
InfrastructureNamespace
,
PresentationNamespace
,
ApiNamespace
};
// Act
var
result
=
Types
.
InAssembly
(
PSManagement
.
Domain
.
AssemblyReference
.
Assembly
)
.
ShouldNot
()
.
HaveDependencyOnAll
(
otherProject
)
.
GetResult
();
// Assert
result
.
IsSuccessful
.
Should
().
BeTrue
();
}
}
}
PSManagement.ArchitectureTests/ArchitectureInfrastructureServicesTests.cs
0 → 100644
View file @
1b8283bb
using
NetArchTest.Rules
;
using
FluentAssertions
;
using
Xunit
;
namespace
PSManagement.ArchitectureTests
{
public
class
ArchitectureInfrastrutureServicesTests
:
ArchitectureTest
{
[
Fact
]
public
void
Services_Should_Not_DependOnOtherProject
()
{
// Arrange
var
otherProject
=
new
[]
{
PresentationNamespace
,
ApiNamespace
,
DataNamespace
};
// Act
var
result
=
Types
.
InAssembly
(
PSManagement
.
Infrastructure
.
Services
.
AssemblyReference
.
Assembly
)
.
ShouldNot
()
.
HaveDependencyOnAll
(
otherProject
)
.
GetResult
();
// Assert
result
.
IsSuccessful
.
Should
().
BeTrue
();
}
}
}
PSManagement.ArchitectureTests/ArchitectureTest.cs
0 → 100644
View file @
1b8283bb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.ArchitectureTests
{
public
class
ArchitectureTest
{
protected
const
string
DomainNamespace
=
"PSManagement.Domain"
;
protected
const
string
ApplicationNamespace
=
"PSManagement.Application"
;
protected
const
string
InfrastructureNamespace
=
"PSManagement.Infrastructure.Services"
;
protected
const
string
DataNamespace
=
"PSManagement.Infrastructure.Persistence"
;
protected
const
string
PresentationNamespace
=
"PSManagement.Presentation"
;
protected
const
string
ApiNamespace
=
"PSManagement.Api"
;
}
}
PSManagement.ArchitectureTests/PSManagement.ArchitectureTests.csproj
0 → 100644
View file @
1b8283bb
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="NetArchTest.Rules" Version="1.3.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PSManagement.Api\PSManagement.Api.csproj" />
<ProjectReference Include="..\PSManagement.Application\PSManagement.Application.csproj" />
<ProjectReference Include="..\PSManagement.Contracts\PSManagement.Contracts.csproj" />
<ProjectReference Include="..\PSManagement.Domain\PSManagement.Domain.csproj" />
<ProjectReference Include="..\PSManagement.Infrastructure.Persistence\PSManagement.Infrastructure.Persistence.csproj" />
<ProjectReference Include="..\PSManagement.Infrastructure\PSManagement.Infrastructure.Services.csproj" />
<ProjectReference Include="..\PSManagement.Presentation\PSManagement.Presentation.csproj" />
<ProjectReference Include="..\PSManagement.SharedKernel\PSManagement.SharedKernel.csproj" />
</ItemGroup>
</Project>
PSManagement.Domain/AssemblyReference/AssemblyReference.cs
0 → 100644
View file @
1b8283bb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Domain
{
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
}
PSManagement.Domain/Projects/Entities/Project.cs
View file @
1b8283bb
...
@@ -207,9 +207,20 @@ namespace PSManagement.Domain.Projects.Entities
...
@@ -207,9 +207,20 @@ namespace PSManagement.Domain.Projects.Entities
}
}
}
}
// Convert the dictionary values to a list for the final result
// Convert the dictionary values to a list for the final result
var
contributions
=
contributionsByEmployee
.
Values
.
ToList
();
var
contributions
=
contributionsByEmployee
.
Values
.
ToList
();
// normalize the values
var
totalContribution
=
Tracks
.
Count
()
;
foreach
(
var
contr
in
contributions
){
contr
.
ContributionRatio
=
contr
.
ContributionRatio
/
totalContribution
;
}
return
contributions
.
AsEnumerable
();
return
contributions
.
AsEnumerable
();
}
}
...
...
PSManagement.Infrastructure.Persistence/AssemblyReference/AssemblyReference.cs
0 → 100644
View file @
1b8283bb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Infrastructure.Persistence
{
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
}
PSManagement.Infrastructure/AssemblyReference/AssemblyReference.cs
0 → 100644
View file @
1b8283bb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
PSManagement.Infrastructure.Services
{
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
}
PSManagement.Presentation/DependencyInjection/DependencyInjection.cs
View file @
1b8283bb
using
Microsoft.Extensions.Configuration
;
using
AutoMapper
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
PSManagement.Api.Mappers
;
namespace
PSManagement.Presentaion.DI
namespace
PSManagement.Presentaion.DI
{
{
...
@@ -7,9 +9,45 @@ namespace PSManagement.Presentaion.DI
...
@@ -7,9 +9,45 @@ namespace PSManagement.Presentaion.DI
{
{
public
static
IServiceCollection
AddPresentation
(
this
IServiceCollection
services
)
public
static
IServiceCollection
AddPresentation
(
this
IServiceCollection
services
)
{
{
services
.
AddMapper
()
.
AddMyControllers
()
;
return
services
;
}
#
region
Configure
controllers
private
static
IServiceCollection
AddMyControllers
(
this
IServiceCollection
services
)
{
services
.
AddControllers
()
.
AddApplicationPart
(
Presentation
.
AssemblyReference
.
Assembly
);
return
services
;
return
services
;
}
}
#
endregion
Configure
controllers
#
region
Mappers
private
static
IServiceCollection
AddMapper
(
this
IServiceCollection
services
)
{
services
.
AddScoped
<
Mapper
>();
services
.
AddAutoMapper
(
cfg
=>
{
cfg
.
AddProfile
<
CustomerMapperConfiguration
>();
cfg
.
AddProfile
<
ProjectMapperConfiguration
>();
cfg
.
AddProfile
<
MappersConfigurations
>();
cfg
.
AddProfile
<
EmployeeMapperConfiguration
>();
});
return
services
;
}
#
endregion
Mappers
}
}
}
}
PSManagement.
Api
/Mappers/CustomerMapperConfiguration.cs
→
PSManagement.
Presentation
/Mappers/CustomerMapperConfiguration.cs
View file @
1b8283bb
File moved
PSManagement.
Api
/Mappers/EmployeeMapperConfiguration.cs
→
PSManagement.
Presentation
/Mappers/EmployeeMapperConfiguration.cs
View file @
1b8283bb
File moved
PSManagement.
Api
/Mappers/MappersConfigurations.cs
→
PSManagement.
Presentation
/Mappers/MappersConfigurations.cs
View file @
1b8283bb
File moved
PSManagement.
Api
/Mappers/ProjectMapperConfiguration.cs
→
PSManagement.
Presentation
/Mappers/ProjectMapperConfiguration.cs
View file @
1b8283bb
File moved
ProjectsStatusManagement.sln
View file @
1b8283bb
...
@@ -39,6 +39,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence"
...
@@ -39,6 +39,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence"
EndProject
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{2FF0133A-7AC6-4346-AEC2-CB5C36939AC7}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{2FF0133A-7AC6-4346-AEC2-CB5C36939AC7}"
EndProject
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{A01E75A3-EF06-4880-8EFE-2E2D8EC0FA9F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ArchitectureTests", "ArchitectureTests", "{EECB1F9F-F97D-4A58-BC3D-62490B931836}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{9E74DD5B-202D-4DAD-9A08-3C7340CEF939}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IntegerationTests", "IntegerationTests", "{83FB2F8C-3B65-44D8-A4A7-8E87166233CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSManagement.ArchitectureTests", "PSManagement.ArchitectureTests\PSManagement.ArchitectureTests.csproj", "{394812BD-ECB4-4B7B-A6FF-4310E145450A}"
EndProject
Global
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Any CPU = Debug|Any CPU
...
@@ -77,6 +87,10 @@ Global
...
@@ -77,6 +87,10 @@ Global
{430FC82E-16C9-453F-92D3-F4E35F52E0F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{430FC82E-16C9-453F-92D3-F4E35F52E0F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{430FC82E-16C9-453F-92D3-F4E35F52E0F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{430FC82E-16C9-453F-92D3-F4E35F52E0F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{430FC82E-16C9-453F-92D3-F4E35F52E0F0}.Release|Any CPU.Build.0 = Release|Any CPU
{430FC82E-16C9-453F-92D3-F4E35F52E0F0}.Release|Any CPU.Build.0 = Release|Any CPU
{394812BD-ECB4-4B7B-A6FF-4310E145450A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{394812BD-ECB4-4B7B-A6FF-4310E145450A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{394812BD-ECB4-4B7B-A6FF-4310E145450A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{394812BD-ECB4-4B7B-A6FF-4310E145450A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
HideSolutionNode = FALSE
...
@@ -99,6 +113,10 @@ Global
...
@@ -99,6 +113,10 @@ Global
{430FC82E-16C9-453F-92D3-F4E35F52E0F0} = {E40CD9A8-20E3-4D39-992B-F7DA048E3B4C}
{430FC82E-16C9-453F-92D3-F4E35F52E0F0} = {E40CD9A8-20E3-4D39-992B-F7DA048E3B4C}
{E40CD9A8-20E3-4D39-992B-F7DA048E3B4C} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1}
{E40CD9A8-20E3-4D39-992B-F7DA048E3B4C} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1}
{2FF0133A-7AC6-4346-AEC2-CB5C36939AC7} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1}
{2FF0133A-7AC6-4346-AEC2-CB5C36939AC7} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1}
{EECB1F9F-F97D-4A58-BC3D-62490B931836} = {A01E75A3-EF06-4880-8EFE-2E2D8EC0FA9F}
{9E74DD5B-202D-4DAD-9A08-3C7340CEF939} = {A01E75A3-EF06-4880-8EFE-2E2D8EC0FA9F}
{83FB2F8C-3B65-44D8-A4A7-8E87166233CD} = {A01E75A3-EF06-4880-8EFE-2E2D8EC0FA9F}
{394812BD-ECB4-4B7B-A6FF-4310E145450A} = {EECB1F9F-F97D-4A58-BC3D-62490B931836}
EndGlobalSection
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5B34709A-AE37-4026-9182-CB9C7ADDEAF5}
SolutionGuid = {5B34709A-AE37-4026-9182-CB9C7ADDEAF5}
...
...
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