test domain events (#2)

* test domain events

* cleanup
This commit is contained in:
2022-10-10 12:06:08 +03:00
committed by GitHub
parent 9076dcc542
commit 8d68f1b7a1
13 changed files with 140 additions and 20 deletions
@@ -1,7 +1,8 @@
using FluentAssertions;
using Moq;
using PracticeCalendar.Application.PracticeEvents.Commands;
using PracticeCalendar.Application.PracticeEvents.Queries;
using PracticeCalendar.Domain.Common;
using static PracticeCalendar.UnitTests.Integration.Testing;
namespace PracticeCalendar.UnitTests.Integration.PracticeEvents
@@ -38,6 +39,9 @@ namespace PracticeCalendar.UnitTests.Integration.PracticeEvents
result.Should().NotBeNull();
result.Id.Should().NotBe(0);
result.Attendees.Count.Should().Be(2);
//check domain events count
domainEventServiceMock.Verify(x=>x.Publish(It.IsAny<DomainEventBase>()), Times.Exactly(2));
}
}
}
@@ -26,7 +26,8 @@ namespace PracticeCalendar.UnitTests.Integration.PracticeEvents
{
await RunBeforeAnyTests();
await AddAsync(new PracticeEvent("Test Event", "Event description")
await AddAsync(new PracticeEvent("Test Event", "Event description",
DateTime.Now.AddHours(-1), DateTime.Now.AddHours(1))
{
Id = 1,
Attendees = {