-
-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the initial Event Driven Architecture Workshop projects structure
Added also event definition exercises
- Loading branch information
1 parent
419849c
commit cad035a
Showing
16 changed files
with
404 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Workshops/EventDrivenArchitecture/00-Modelling/00-Modelling.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Modelling</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Bogus" Version="35.5.1" /> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="Ogooreck" Version="0.8.2" /> | ||
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit" Version="2.8.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.6" /> | ||
</ItemGroup> | ||
|
||
</Project> |
27 changes: 27 additions & 0 deletions
27
Workshops/EventDrivenArchitecture/01-EventsDefinition/01-EventsDefinition.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>EventsDefinition</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Bogus" Version="35.5.1" /> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="Ogooreck" Version="0.8.2" /> | ||
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit" Version="2.8.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.6" /> | ||
</ItemGroup> | ||
|
||
</Project> |
43 changes: 43 additions & 0 deletions
43
Workshops/EventDrivenArchitecture/01-EventsDefinition/EventsDefinitionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace EventsDefinition; | ||
|
||
public class EventsDefinitionTests | ||
{ | ||
[Fact] | ||
[Trait("Category", "SkipCI")] | ||
public void GuestStayAccountEventTypes_AreDefined() | ||
{ | ||
// Given | ||
|
||
// When | ||
var events = new object[] | ||
{ | ||
// 2. TODO: Put your sample events here | ||
}; | ||
|
||
// Then | ||
const int minimumExpectedEventTypesCount = 5; | ||
events.Should().HaveCountGreaterThan(minimumExpectedEventTypesCount); | ||
events.GroupBy(e => e.GetType()).Should().HaveCount(minimumExpectedEventTypesCount); | ||
} | ||
|
||
[Fact] | ||
[Trait("Category", "SkipCI")] | ||
public void GroupCheckoutEventTypes_AreDefined() | ||
{ | ||
// Given | ||
|
||
// When | ||
var events = new object[] | ||
{ | ||
// 2. TODO: Put your sample events here | ||
}; | ||
|
||
// Then | ||
const int minimumExpectedEventTypesCount = 3; | ||
events.Should().HaveCountGreaterThan(minimumExpectedEventTypesCount); | ||
events.GroupBy(e => e.GetType()).Should().HaveCount(minimumExpectedEventTypesCount); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Workshops/EventDrivenArchitecture/01-EventsDefinition/GroupCheckoutEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace EventsDefinition; | ||
|
||
// 1. TODO: Define your Group Checkout events here |
3 changes: 3 additions & 0 deletions
3
Workshops/EventDrivenArchitecture/01-EventsDefinition/GuestStayAccountEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace EventsDefinition; | ||
|
||
// 1. TODO: Define your Guest Stay Account events here |
10 changes: 10 additions & 0 deletions
10
Workshops/EventDrivenArchitecture/02-EntitiesDefinition/02-EntitiesDefinition.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_02_EntitiesDefinition</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
Workshops/EventDrivenArchitecture/03-BusinessProcesses/03-BusinessProcesses.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_03_BusinessProcesses</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
Workshops/EventDrivenArchitecture/04-Idempotency/04-Idempotency.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_04_Idempotency</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
Workshops/EventDrivenArchitecture/04-Integration/04-Integration.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_04_Integration</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
Workshops/EventDrivenArchitecture/05-OptimisticConcurrency/05-OptimisticConcurrency.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_05_OptimisticConcurrency</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
Workshops/EventDrivenArchitecture/06-Idempotency/06-Idempotency.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>_06_Idempotency</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
63 changes: 63 additions & 0 deletions
63
Workshops/EventDrivenArchitecture/EventDrivenArchitecture.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01-EventsDefinition", "01-EventsDefinition\01-EventsDefinition.csproj", "{ACA4AB19-8D56-4297-830B-2C50EA2A796B}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "00-Modelling", "00-Modelling\00-Modelling.csproj", "{F081DB32-DE1E-4040-AE81-1BEC4EC9B0D6}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02-EntitiesDefinition", "02-EntitiesDefinition\02-EntitiesDefinition.csproj", "{00E684F9-A74A-475D-80F5-910FA1CF6C68}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03-BusinessProcesses", "03-BusinessProcesses\03-BusinessProcesses.csproj", "{424A8F06-A959-4C75-A0E0-0B866802D036}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "04-Integration", "04-Integration\04-Integration.csproj", "{24473D77-D757-4A8B-8F07-6875C6A2C690}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "05-OptimisticConcurrency", "05-OptimisticConcurrency\05-OptimisticConcurrency.csproj", "{FB0D7F5C-F605-461C-A6D9-3E9ACF4071F2}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "06-Idempotency", "06-Idempotency\06-Idempotency.csproj", "{0BEBAE71-5B1B-4CA8-B307-99E3F334A73B}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solutions", "Solutions", "{96700308-E324-4D7A-854D-9ED17ECEE9B7}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01-EventsDefinition", "Solutions\01-EventsDefinition\01-EventsDefinition.csproj", "{7312A099-6FAD-462A-8D94-FB817B531A27}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{ACA4AB19-8D56-4297-830B-2C50EA2A796B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{ACA4AB19-8D56-4297-830B-2C50EA2A796B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{ACA4AB19-8D56-4297-830B-2C50EA2A796B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{ACA4AB19-8D56-4297-830B-2C50EA2A796B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F081DB32-DE1E-4040-AE81-1BEC4EC9B0D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F081DB32-DE1E-4040-AE81-1BEC4EC9B0D6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F081DB32-DE1E-4040-AE81-1BEC4EC9B0D6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F081DB32-DE1E-4040-AE81-1BEC4EC9B0D6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{00E684F9-A74A-475D-80F5-910FA1CF6C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{00E684F9-A74A-475D-80F5-910FA1CF6C68}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{00E684F9-A74A-475D-80F5-910FA1CF6C68}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{00E684F9-A74A-475D-80F5-910FA1CF6C68}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{424A8F06-A959-4C75-A0E0-0B866802D036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{424A8F06-A959-4C75-A0E0-0B866802D036}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{424A8F06-A959-4C75-A0E0-0B866802D036}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{424A8F06-A959-4C75-A0E0-0B866802D036}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{24473D77-D757-4A8B-8F07-6875C6A2C690}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{24473D77-D757-4A8B-8F07-6875C6A2C690}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{24473D77-D757-4A8B-8F07-6875C6A2C690}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{24473D77-D757-4A8B-8F07-6875C6A2C690}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{FB0D7F5C-F605-461C-A6D9-3E9ACF4071F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{FB0D7F5C-F605-461C-A6D9-3E9ACF4071F2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{FB0D7F5C-F605-461C-A6D9-3E9ACF4071F2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{FB0D7F5C-F605-461C-A6D9-3E9ACF4071F2}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{0BEBAE71-5B1B-4CA8-B307-99E3F334A73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0BEBAE71-5B1B-4CA8-B307-99E3F334A73B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0BEBAE71-5B1B-4CA8-B307-99E3F334A73B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0BEBAE71-5B1B-4CA8-B307-99E3F334A73B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{7312A099-6FAD-462A-8D94-FB817B531A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7312A099-6FAD-462A-8D94-FB817B531A27}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7312A099-6FAD-462A-8D94-FB817B531A27}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7312A099-6FAD-462A-8D94-FB817B531A27}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{7312A099-6FAD-462A-8D94-FB817B531A27} = {96700308-E324-4D7A-854D-9ED17ECEE9B7} | ||
EndGlobalSection | ||
EndGlobal |
27 changes: 27 additions & 0 deletions
27
Workshops/EventDrivenArchitecture/Solutions/01-EventsDefinition/01-EventsDefinition.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>EventsDefinition</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Bogus" Version="35.5.1" /> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="Ogooreck" Version="0.8.2" /> | ||
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit" Version="2.8.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.6" /> | ||
</ItemGroup> | ||
|
||
</Project> |
60 changes: 60 additions & 0 deletions
60
Workshops/EventDrivenArchitecture/Solutions/01-EventsDefinition/EventsDefinitionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace EventsDefinition; | ||
|
||
using static GuestStayAccountEvent; | ||
using static GroupCheckoutEvent; | ||
|
||
public class EventsDefinitionTests | ||
{ | ||
[Fact] | ||
public void GuestStayAccountEventTypes_AreDefined() | ||
{ | ||
// Given | ||
var guestStayId = Guid.NewGuid(); | ||
var groupCheckoutId = Guid.NewGuid(); | ||
|
||
// When | ||
var events = new GuestStayAccountEvent[] | ||
{ | ||
new GuestCheckedIn(guestStayId, DateTimeOffset.Now), | ||
new ChargeRecorded(guestStayId, 100, DateTimeOffset.Now), | ||
new PaymentRecorded(guestStayId, 100, DateTimeOffset.Now), | ||
new GuestCheckedOut(guestStayId, DateTimeOffset.Now, groupCheckoutId), | ||
new GuestStayAccountEvent.GuestCheckoutFailed(guestStayId, | ||
GuestStayAccountEvent.GuestCheckoutFailed.FailureReason.NotOpened, DateTimeOffset.Now, | ||
groupCheckoutId) | ||
}; | ||
|
||
// Then | ||
const int minimumExpectedEventTypesCount = 5; | ||
events.Should().HaveCountGreaterThan(minimumExpectedEventTypesCount); | ||
events.GroupBy(e => e.GetType()).Should().HaveCount(minimumExpectedEventTypesCount); | ||
} | ||
|
||
[Fact] | ||
public void GroupCheckoutEventTypes_AreDefined() | ||
{ | ||
// Given | ||
var groupCheckoutId = Guid.NewGuid(); | ||
Guid[] guestStayIds = [Guid.NewGuid(), Guid.NewGuid()]; | ||
var clerkId = Guid.NewGuid(); | ||
|
||
// When | ||
var events = new GroupCheckoutEvent[] | ||
{ | ||
new GroupCheckoutInitiated(groupCheckoutId, clerkId, guestStayIds, DateTimeOffset.Now), | ||
new GuestCheckoutsInitiated(groupCheckoutId, guestStayIds, DateTimeOffset.Now), | ||
new GuestCheckoutCompleted(groupCheckoutId, guestStayIds[0], DateTimeOffset.Now), | ||
new GroupCheckoutEvent.GuestCheckoutFailed(groupCheckoutId, guestStayIds[1], DateTimeOffset.Now), | ||
new GroupCheckoutFailed(groupCheckoutId, [guestStayIds[0]], [guestStayIds[1]], DateTimeOffset.Now), | ||
new GroupCheckoutCompleted(groupCheckoutId, guestStayIds, DateTimeOffset.Now) | ||
}; | ||
|
||
// Then | ||
const int minimumExpectedEventTypesCount = 3; | ||
events.Should().HaveCountGreaterThan(minimumExpectedEventTypesCount); | ||
events.GroupBy(e => e.GetType()).Should().HaveCount(minimumExpectedEventTypesCount); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
Workshops/EventDrivenArchitecture/Solutions/01-EventsDefinition/GroupCheckoutEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace EventsDefinition; | ||
|
||
// 1. TODO: Define your Group Checkout events here | ||
|
||
public abstract record GroupCheckoutEvent | ||
{ | ||
public record GroupCheckoutInitiated( | ||
Guid GroupCheckoutId, | ||
Guid ClerkId, | ||
Guid[] GuestStayIds, | ||
DateTimeOffset InitiatedAt | ||
): GroupCheckoutEvent; | ||
|
||
public record GuestCheckoutsInitiated( | ||
Guid GroupCheckoutId, | ||
Guid[] InitiatedGuestStayIds, | ||
DateTimeOffset InitiatedAt | ||
): GroupCheckoutEvent; | ||
|
||
public record GuestCheckoutCompleted( | ||
Guid GroupCheckoutId, | ||
Guid GuestStayId, | ||
DateTimeOffset CompletedAt | ||
): GroupCheckoutEvent; | ||
|
||
public record GuestCheckoutFailed( | ||
Guid GroupCheckoutId, | ||
Guid GuestStayId, | ||
DateTimeOffset FailedAt | ||
): GroupCheckoutEvent; | ||
|
||
public record GroupCheckoutCompleted( | ||
Guid GroupCheckoutId, | ||
Guid[] CompletedCheckouts, | ||
DateTimeOffset CompletedAt | ||
): GroupCheckoutEvent; | ||
|
||
public record GroupCheckoutFailed( | ||
Guid GroupCheckoutId, | ||
Guid[] CompletedCheckouts, | ||
Guid[] FailedCheckouts, | ||
DateTimeOffset FailedAt | ||
): GroupCheckoutEvent; | ||
|
||
private GroupCheckoutEvent() { } | ||
} |
Oops, something went wrong.