Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.user
*.userosscache
*.sln.docstates
*.[Dd]evelopment.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace EstateManagement.BusinessLogic.CommandHandlers
{
using System;
using System.Threading;
using System.Threading.Tasks;
using Commands;
Expand Down Expand Up @@ -45,7 +46,15 @@ private async Task HandleCommand(CreateEstateCommand command,

estateAggregate.Register(command.Name);

await this.EstateAggregateRepository.SaveChanges(estateAggregate, cancellationToken);
try
{
await this.EstateAggregateRepository.SaveChanges(estateAggregate, cancellationToken);
}
catch(Exception e)
{
throw;
}

}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Shared" Version="0.0.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="0.0.2" />
<PackageReference Include="Shared" Version="0.0.3.1" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="0.0.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion EstateManagement.Client/EstateManagement.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="0.0.2" />
<PackageReference Include="ClientProxyBase" Version="0.0.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Shared.DomainDrivenDesign" Version="0.0.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="0.0.3.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Shared.EventStore" Version="0.0.2" />
<PackageReference Include="Shared.EventStore" Version="0.0.3.1" />
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
Expand Down
12 changes: 12 additions & 0 deletions EstateManagement.EstateAggregate/EstateAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ public void Register(String estateName)
this.ApplyAndPend(estateCreatedEvent);
}

/// <summary>
/// Gets the metadata.
/// </summary>
/// <returns></returns>
protected override Object GetMetadata()
{
return new
{
EstateId = this.AggregateId
};
}

/// <summary>
/// Plays the event.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Shared" Version="0.0.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="0.0.2" />
<PackageReference Include="Shared.EventStore" Version="0.0.2" />
<PackageReference Include="Shared" Version="0.0.3.1" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="0.0.3.1" />
<PackageReference Include="Shared.EventStore" Version="0.0.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="0.0.2" />
<PackageReference Include="ClientProxyBase" Version="0.0.3.1" />
<PackageReference Include="Ductus.FluentDocker" Version="2.7.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
Expand Down
8 changes: 4 additions & 4 deletions EstateManagement.Tests/Common/EstateManagementWebFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)

builder.ConfigureServices((builderContext, services) =>
{
if (commandRouterMock != null)
{
services.AddSingleton(commandRouterMock.Object);
}
//if (commandRouterMock != null)
//{
// services.AddSingleton(commandRouterMock.Object);
//}

services.AddMvc(options =>
{
Expand Down
16 changes: 15 additions & 1 deletion EstateManagement.Tests/ControllerTests/EstateControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
using DataTransferObjects.Requests;
using DataTransferObjects.Responses;
using EstateManagement.Testing;
using Lamar;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Newtonsoft.Json;
using Shared.DomainDrivenDesign.CommandHandling;
using Shouldly;
using Xunit;

Expand All @@ -32,11 +36,21 @@ public EstateControllerTests(EstateManagementWebFactory<Startup> webApplicationF
this.WebApplicationFactory = webApplicationFactory;
}

[Fact(Skip = "Lamar")]
[Fact(Skip="Issue with Lamar")]
public async Task GolfClubAdministratorController_POST_GolfClubAdministrator_GolfClubAdministratorIsReturned()
{
// 1. Arrange
HttpClient client = this.WebApplicationFactory.CreateClient();
var container = Startup.Container;

Mock<ICommandRouter> commandRouterMock = new Mock<ICommandRouter>(MockBehavior.Strict);

commandRouterMock.Setup(c => c.Route(It.IsAny<ICommand>(), It.IsAny<CancellationToken>())).Returns(Task.CompletedTask);

ServiceCollection services = new ServiceCollection();
services.AddSingleton(commandRouterMock.Object);

container.Configure(services);

CreateEstateRequest createEstateRequest = TestData.CreateEstateRequest;
String uri = "api/estates/";
Expand Down
2 changes: 1 addition & 1 deletion EstateManagement/Controllers/EstateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class EstateController : ControllerBase
/// <param name="commandRouter">The command router.</param>
/// <param name="estateManagmentManager">The estate managment manager.</param>
/// <param name="modelFactory">The model factory.</param>
public EstateController(CommandRouter commandRouter,
public EstateController(ICommandRouter commandRouter,
IEstateManagmentManager estateManagmentManager,
IModelFactory modelFactory)
{
Expand Down
4 changes: 2 additions & 2 deletions EstateManagement/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF

ConfigurationReader.Initialise(Startup.Configuration);

app.AddExceptionHandler();
app.AddRequestLogging();
app.AddResponseLogging();

app.AddExceptionHandler();

app.UseRouting();

app.UseAuthorization();
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
## Code Coverage Results

[![Coverage Status](https://coveralls.io/repos/github/StuartFerguson/EstateManagement/badge.svg)](https://coveralls.io/github/StuartFerguson/EstateManagement)

## Code Quality Results

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5bcb33c3c68e473193a872f0d3375f61)](https://www.codacy.com/manual/stuart_ferguson1/EstateManagement?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=StuartFerguson/EstateManagement&amp;utm_campaign=Badge_Grade)