File tree Expand file tree Collapse file tree 4 files changed +42
-22
lines changed
src/Winton.DomainModelling.Abstractions
test/Winton.DomainModelling.Abstractions.Tests Expand file tree Collapse file tree 4 files changed +42
-22
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ node {
1212 }
1313
1414 stage(" Build" ) {
15- bat(" \" ${ tool 'MSBuild15'} \" /p:Configuration=Release" )
15+ bat(" \" ${ tool 'MSBuild15'} \" /p:Configuration=Release /p:GetVersion=True /p:WriteVersionInfoToBuildLog=True " )
1616 }
1717
1818 stage(" Test" ) {
19- dir( " test \\ Winton.DomainModelling.Abstractions.Tests " ) {
20- bat( " dotnet test Winton.DomainModelling.Abstractions.Tests.csproj --configuration Release --no-restore --no-build " )
21- }
19+ parallel [
20+ " unit-tests " : { test( " Winton.DomainModelling.Abstractions.Tests" ) }
21+ ]
2222 }
2323
2424 stage(" Publish" ) {
@@ -40,4 +40,12 @@ node {
4040 finally {
4141 step([$class : ' StashNotifier' ])
4242 }
43+ }
44+
45+ def test (testProjectName ) {
46+ dir(" test" ) {
47+ dir(" ${ testProjectName} " ) {
48+ bat(" dotnet test --configuration Release --no-restore --no-build" )
49+ }
50+ }
4351}
Original file line number Diff line number Diff line change @@ -6,18 +6,25 @@ namespace Winton.DomainModelling
66 /// <summary>
77 /// An error indicating that an entity could not be found.
88 /// </summary>
9- /// <typeparam name="TEntity">The type of entity.</typeparam>
10- /// <typeparam name="TEntityId">The type of entity id.</typeparam>
11- public class EntityNotFoundException < TEntity , TEntityId > : DomainException
12- where TEntity : Entity < TEntityId >
13- where TEntityId : IEquatable < TEntityId >
9+ public class EntityNotFoundException : DomainException
1410 {
11+ private EntityNotFoundException ( string message )
12+ : base ( message )
13+ {
14+ }
15+
1516 /// <summary>
16- /// Initializes a new instance of the <see cref="EntityNotFoundException{TEntity, TEntityId}" /> class.
17+ /// Creates a new instance of the <see cref="EntityNotFoundException" /> class using the generic constraint to generate
18+ /// the message.
1719 /// </summary>
18- public EntityNotFoundException ( )
19- : base ( $ "The specified { typeof ( TEntity ) . Name } could not be found.")
20+ /// <typeparam name="TEntity">The type of the entity.</typeparam>
21+ /// <typeparam name="TEntityId">The type of the entity id.</typeparam>
22+ /// <returns>A new instance of <see cref="EntityNotFoundException" />.</returns>
23+ public static EntityNotFoundException Create < TEntity , TEntityId > ( )
24+ where TEntity : Entity < TEntityId >
25+ where TEntityId : IEquatable < TEntityId >
2026 {
27+ return new EntityNotFoundException ( $ "The specified { typeof ( TEntity ) . Name } could not be found.") ;
2128 }
2229 }
2330}
Original file line number Diff line number Diff line change 66 <Copyright >Copyright 2018 Winton</Copyright >
77 <Description >Provides common abstractions for domain modelling.</Description >
88 <GenerateDocumentationFile >True</GenerateDocumentationFile >
9+ <GetVersion >False</GetVersion >
910 <NoWarn >$(NoWarn);SA0001;SA1101;SA1309;SA1413;SA1633;SA1652</NoWarn >
1011 <PackageId >Winton.DomainModelling.Abstractions</PackageId >
1112 <PackageRequireLicenseAcceptance >False</PackageRequireLicenseAcceptance >
1516 <TargetFramework >netstandard1.0</TargetFramework >
1617 <Title >Winton Domain Modelling Abstractions</Title >
1718 <TreatWarningsAsErrors >True</TreatWarningsAsErrors >
19+ <WriteVersionInfoToBuildLog >False</WriteVersionInfoToBuildLog >
1820 </PropertyGroup >
1921
2022 <PropertyGroup Condition =" '$(Configuration)' == 'Release'" >
Original file line number Diff line number Diff line change @@ -5,20 +5,23 @@ namespace Winton.DomainModelling
55{
66 public class EntityNotFoundExceptionTests
77 {
8- [ Fact ]
9- private void ShouldSetMessageBasedOnTypeOfEntity ( )
8+ public sealed class Message : EntityNotFoundExceptionTests
109 {
11- var exception = new EntityNotFoundException < TestEntity , int > ( ) ;
10+ [ Fact ]
11+ private void ShouldSetMessageBasedOnTypeOfEntity ( )
12+ {
13+ EntityNotFoundException exception = EntityNotFoundException . Create < TestEntity , int > ( ) ;
1214
13- exception . Message . Should ( ) . Be ( "The specified TestEntity could not be found." ) ;
14- }
15+ exception . Message . Should ( ) . Be ( "The specified TestEntity could not be found." ) ;
16+ }
1517
16- // ReSharper disable once ClassNeverInstantiated.Local
17- private sealed class TestEntity : Entity < int >
18- {
19- public TestEntity ( int id )
20- : base ( id )
18+ // ReSharper disable once ClassNeverInstantiated.Local
19+ private sealed class TestEntity : Entity < int >
2120 {
21+ public TestEntity ( int id )
22+ : base ( id )
23+ {
24+ }
2225 }
2326 }
2427 }
You can’t perform that action at this time.
0 commit comments