Commit 877ca99a authored by Steve Smith's avatar Steve Smith

Adding tests and refactoring handler

parent e782a7a2
...@@ -15,6 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanArchitecture.Web", "sr ...@@ -15,6 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanArchitecture.Web", "sr
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanArchitecture.Tests", "tests\CleanArchitecture.Tests\CleanArchitecture.Tests.csproj", "{AEE17BAB-D187-4BC5-B640-40CC0749566C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanArchitecture.Tests", "tests\CleanArchitecture.Tests\CleanArchitecture.Tests.csproj", "{AEE17BAB-D187-4BC5-B640-40CC0749566C}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{250F283E-FE2F-4BBD-9E63-A2265B84E23F}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
......
...@@ -4,7 +4,7 @@ using CleanArchitecture.Core.Interfaces; ...@@ -4,7 +4,7 @@ using CleanArchitecture.Core.Interfaces;
namespace CleanArchitecture.Core.Services namespace CleanArchitecture.Core.Services
{ {
public class ToDoItemService : IHandle<ToDoItemCompletedEvent> public class ItemCompletedEmailNotificationHandler : IHandle<ToDoItemCompletedEvent>
{ {
public void Handle(ToDoItemCompletedEvent domainEvent) public void Handle(ToDoItemCompletedEvent domainEvent)
{ {
......
namespace CleanArchitecture.Core.Services
{
public class SomeDomainService
{
// TODO: This would handle operations involving multiple aggregates or entities
}
}
using CleanArchitecture.Core.Entities;
using CleanArchitecture.Core.Events;
using CleanArchitecture.Core.Services;
using System;
using Xunit;
namespace CleanArchitecture.Tests.Core.Entities
{
public class ItemCompletedEmailNotificationHandlerHandle
{
[Fact]
public void ThrowsExceptionGivenNullEventArgument()
{
var handler = new ItemCompletedEmailNotificationHandler();
Exception ex = Assert.Throws<ArgumentNullException>(() => handler.Handle(null));
}
[Fact]
public void DoesNothingGivenEventInstance()
{
var handler = new ItemCompletedEmailNotificationHandler();
handler.Handle(new ToDoItemCompletedEvent(new ToDoItem()));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment