diff --git a/test/Cap.Consistency.Test/ConsistencyMessageManagerTest.cs b/test/Cap.Consistency.Test/ConsistencyMessageManagerTest.cs index 7645a2a..fe8642c 100644 --- a/test/Cap.Consistency.Test/ConsistencyMessageManagerTest.cs +++ b/test/Cap.Consistency.Test/ConsistencyMessageManagerTest.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Xunit; using Microsoft.Extensions.Logging; using Moq; +using System.Threading; namespace Cap.Consistency.Test { @@ -49,5 +50,26 @@ namespace Cap.Consistency.Test : base(new Mock>().Object, null, null) { } } + + [Fact] + public async Task CreateCallsStore() { + var store = new Mock>(); + var message = new TestConsistencyMessage { Time = DateTime.Now }; + store.Setup(x => x.CreateAsync(message, CancellationToken.None)).ReturnsAsync(OperateResult.Success).Verifiable(); + var messageManager = TestConsistencyMessageManager(store.Object); + + var result = await messageManager.CreateAsync(message); + + Assert.True(result.Succeeded); + store.VerifyAll(); + } + + public ConsistencyMessageManager TestConsistencyMessageManager(IConsistencyMessageStore store = null) + where TMessage : class { + store = store ?? new Mock>().Object; + var mockLogger = new Mock>>().Object; + var manager = new ConsistencyMessageManager(store, null, mockLogger); + return manager; + } } }