mirror of
https://github.com/bitwarden/server
synced 2026-01-14 22:43:19 +00:00
Move all event integration code to Dirt (#6757)
* Move all event integration code to Dirt * Format to fix lint
This commit is contained in:
36
test/Core.Test/Dirt/Services/EventRepositoryHandlerTests.cs
Normal file
36
test/Core.Test/Dirt/Services/EventRepositoryHandlerTests.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Bit.Core.Dirt.Services.Implementations;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using Bit.Test.Common.Helpers;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Core.Test.Dirt.Services;
|
||||
|
||||
[SutProviderCustomize]
|
||||
public class EventRepositoryHandlerTests
|
||||
{
|
||||
[Theory, BitAutoData]
|
||||
public async Task HandleEventAsync_WritesEventToIEventWriteService(
|
||||
EventMessage eventMessage,
|
||||
SutProvider<EventRepositoryHandler> sutProvider)
|
||||
{
|
||||
await sutProvider.Sut.HandleEventAsync(eventMessage);
|
||||
await sutProvider.GetDependency<IEventWriteService>().Received(1).CreateAsync(
|
||||
Arg.Is(AssertHelper.AssertPropertyEqual<IEvent>(eventMessage))
|
||||
);
|
||||
}
|
||||
|
||||
[Theory, BitAutoData]
|
||||
public async Task HandleManyEventAsync_WritesEventsToIEventWriteService(
|
||||
IEnumerable<EventMessage> eventMessages,
|
||||
SutProvider<EventRepositoryHandler> sutProvider)
|
||||
{
|
||||
await sutProvider.Sut.HandleManyEventsAsync(eventMessages);
|
||||
await sutProvider.GetDependency<IEventWriteService>().Received(1).CreateManyAsync(
|
||||
Arg.Is(AssertHelper.AssertPropertyEqual<IEvent>(eventMessages))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user