From 9bcd354579e0fa08fe4e3acd0a358288eef11ddc Mon Sep 17 00:00:00 2001 From: Jack Herring Date: Sun, 9 Jun 2019 16:46:05 +0100 Subject: [PATCH 1/6] Add failing tests --- .../AggregateReadStoreManagerTests.cs | 20 +-- .../AsyncReadModelPopulatorTests.cs | 6 + .../ReadStores/BaseReadModelTests.cs | 137 +++++++++++++++++ .../MultipleAggregateReadStoreManagerTests.cs | 4 +- .../ReadStores/ReadModelPopulatorTests.cs | 139 +----------------- .../ReadStores/ReadStoreManagerTestSuite.cs | 28 ++-- .../SingleAggregateReadStoreManagerTests.cs | 4 +- .../ReadStores/TestAsyncReadModel.cs | 20 +++ .../{TReadModel.cs => TestReadModel.cs} | 2 +- 9 files changed, 193 insertions(+), 167 deletions(-) create mode 100644 Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs create mode 100644 Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs create mode 100644 Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs rename Source/EventFlow.Tests/UnitTests/ReadStores/{TReadModel.cs => TestReadModel.cs} (97%) diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/AggregateReadStoreManagerTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/AggregateReadStoreManagerTests.cs index 5ebbc6ce9..8fbad2b78 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/AggregateReadStoreManagerTests.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/AggregateReadStoreManagerTests.cs @@ -44,8 +44,8 @@ namespace EventFlow.Tests.UnitTests.ReadStores public class AggregateReadStoreManagerTests : ReadStoreManagerTestSuite, - TReadModel>> + IReadModelStore, + TestReadModel>> { private Mock _eventStoreMock; @@ -64,9 +64,9 @@ public async Task EventsAreApplied() { ToDomainEvent(thingyId, A(), 3), }; - Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( + Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( thingyId.Value, - A(), + A(), 2)); // Act @@ -86,9 +86,9 @@ public async Task AlreadyAppliedEventsAreNotApplied() { ToDomainEvent(thingyId, A(), 3), }; - var resultingReadModelUpdates = Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( + var resultingReadModelUpdates = Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( thingyId.Value, - A(), + A(), 3)); // Act @@ -108,9 +108,9 @@ public async Task OutdatedEventsAreNotApplied() { ToDomainEvent(thingyId, A(), 1), }; - Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( + Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( thingyId.Value, - A(), + A(), 3)); // Act @@ -138,9 +138,9 @@ public async Task StoredEventsAreAppliedIfThereAreMissingEvents() .Concat(missingEvents) .Concat(emittedEvents) .ToArray(); - Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( + Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( thingyId.Value, - A(), + A(), 1)); _eventStoreMock.Arrange_LoadEventsAsync(storedEvents); diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs new file mode 100644 index 000000000..23d793f78 --- /dev/null +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs @@ -0,0 +1,6 @@ +namespace EventFlow.Tests.UnitTests.ReadStores +{ + public class AsyncReadModelPopulatorTests : BaseReadModelTests + { + } +} \ No newline at end of file diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs new file mode 100644 index 000000000..89f47bae6 --- /dev/null +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using EventFlow.Aggregates; +using EventFlow.Configuration; +using EventFlow.EventStores; +using EventFlow.ReadStores; +using EventFlow.TestHelpers; +using EventFlow.TestHelpers.Aggregates.Events; +using Moq; +using NUnit.Framework; + +namespace EventFlow.Tests.UnitTests.ReadStores +{ + [Timeout(5000)] + [Category(Categories.Unit)] + public abstract class BaseReadModelTests : TestsFor + where TReadModel : class, IReadModel + { + private const int ReadModelPageSize = 3; + + private Mock> _readModelStoreMock; + private Mock> _readStoreManagerMock; + private Mock _eventFlowConfigurationMock; + private Mock _eventStoreMock; + private Mock _resolverMock; + private List _eventStoreData; + + [SetUp] + public void SetUp() + { + _eventStoreMock = InjectMock(); + _eventStoreData = null; + _resolverMock = InjectMock(); + _readModelStoreMock = new Mock>(); + _readStoreManagerMock = new Mock>(); + _eventFlowConfigurationMock = InjectMock(); + + _resolverMock + .Setup(r => r.Resolve>()) + .Returns(new[] { _readStoreManagerMock.Object }); + _resolverMock + .Setup(r => r.ResolveAll(typeof(IReadModelStore))) + .Returns(new[] { _readModelStoreMock.Object }); + + _eventFlowConfigurationMock + .Setup(c => c.PopulateReadModelEventPageSize) + .Returns(ReadModelPageSize); + + _eventStoreMock + .Setup(s => s.LoadAllEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) + .Returns((s, p, c) => Task.FromResult(GetEvents(s, p))); + _readStoreManagerMock + .Setup(m => m.ReadModelType) + .Returns(typeof(TReadModel)); + } + + [Test] + public async Task PurgeIsCalled() + { + // Act + await Sut.PurgeAsync(CancellationToken.None).ConfigureAwait(false); + + // Assert + _readModelStoreMock.Verify(s => s.DeleteAllAsync(It.IsAny()), Times.Once); + } + + [Test] + public async Task PopulateCallsApplyDomainEvents() + { + // Arrange + ArrangeEventStore(Many(6)); + + // Act + await Sut.PopulateAsync(CancellationToken.None).ConfigureAwait(false); + + // Assert + _readStoreManagerMock.Verify( + s => s.UpdateReadStoresAsync( + It.Is>(l => l.Count == ReadModelPageSize), + It.IsAny()), + Times.Exactly(2)); + } + + [Test] + public async Task UnwantedEventsAreFiltered() + { + // Arrange + var events = new IAggregateEvent[] + { + A(), + A(), + A(), + }; + ArrangeEventStore(events); + + // Act + await Sut.PopulateAsync(CancellationToken.None).ConfigureAwait(false); + + // Assert + _readStoreManagerMock + .Verify( + s => s.UpdateReadStoresAsync( + It.Is>(l => l.Count == 2 && l.All(e => e.EventType == typeof(ThingyPingEvent))), + It.IsAny()), + Times.Once); + } + + private AllEventsPage GetEvents(GlobalPosition globalPosition, int pageSize) + { + var startPosition = globalPosition.IsStart + ? 1 + : int.Parse(globalPosition.Value); + + var events = _eventStoreData + .Skip(Math.Max(startPosition - 1, 0)) + .Take(pageSize) + .ToList(); + + var nextPosition = Math.Min(Math.Max(startPosition, 1) + pageSize, _eventStoreData.Count + 1); + + return new AllEventsPage(new GlobalPosition(nextPosition.ToString()), events); + } + + private void ArrangeEventStore(IEnumerable aggregateEvents) + { + ArrangeEventStore(aggregateEvents.Select(e => ToDomainEvent(e))); + } + + private void ArrangeEventStore(IEnumerable domainEvents) + { + _eventStoreData = domainEvents.ToList(); + } + } +} \ No newline at end of file diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/MultipleAggregateReadStoreManagerTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/MultipleAggregateReadStoreManagerTests.cs index c5cff89f7..de7aab026 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/MultipleAggregateReadStoreManagerTests.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/MultipleAggregateReadStoreManagerTests.cs @@ -36,7 +36,7 @@ namespace EventFlow.Tests.UnitTests.ReadStores { [Category(Categories.Unit)] - public class MultipleAggregateReadStoreManagerTests : ReadStoreManagerTestSuite, TReadModel, IReadModelLocator>> + public class MultipleAggregateReadStoreManagerTests : ReadStoreManagerTestSuite, TestReadModel, IReadModelLocator>> { private Mock _readModelLocator; @@ -100,7 +100,7 @@ public async Task IfNoReadModelIdsAreReturned_ThenDontInvokeTheReadModelStore() s => s.UpdateAsync( It.IsAny>(), It.IsAny(), - It.IsAny, ReadModelEnvelope, CancellationToken, Task>>>(), + It.IsAny, ReadModelEnvelope, CancellationToken, Task>>>(), It.IsAny()), Times.Never); } diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/ReadModelPopulatorTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/ReadModelPopulatorTests.cs index 5da9ea78c..27a9e3bee 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/ReadModelPopulatorTests.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/ReadModelPopulatorTests.cs @@ -21,146 +21,9 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using EventFlow.Aggregates; -using EventFlow.Configuration; -using EventFlow.EventStores; -using EventFlow.ReadStores; -using EventFlow.TestHelpers; -using EventFlow.TestHelpers.Aggregates; -using EventFlow.TestHelpers.Aggregates.Events; -using Moq; -using NUnit.Framework; - namespace EventFlow.Tests.UnitTests.ReadStores { - [Timeout(5000)] - [Category(Categories.Unit)] - public class ReadModelPopulatorTests : TestsFor + public class ReadModelPopulatorTests : BaseReadModelTests { - public class TestReadModel : IReadModel, - IAmReadModelFor - { - public void Apply(IReadModelContext context, IDomainEvent domainEvent) - { - } - } - - private Mock> _readModelStoreMock; - private Mock> _readStoreManagerMock; - private Mock _eventFlowConfigurationMock; - private Mock _eventStoreMock; - private Mock _resolverMock; - private List _eventStoreData; - - [SetUp] - public void SetUp() - { - _eventStoreMock = InjectMock(); - _eventStoreData = null; - _resolverMock = InjectMock(); - _readModelStoreMock = new Mock>(); - _readStoreManagerMock = new Mock>(); - _eventFlowConfigurationMock = InjectMock(); - - _resolverMock - .Setup(r => r.Resolve>()) - .Returns(new[] {_readStoreManagerMock.Object}); - _resolverMock - .Setup(r => r.ResolveAll(typeof(IReadModelStore))) - .Returns(new[] {_readModelStoreMock.Object}); - - _eventFlowConfigurationMock - .Setup(c => c.PopulateReadModelEventPageSize) - .Returns(3); - - _eventStoreMock - .Setup(s => s.LoadAllEventsAsync(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns((s, p, c) => Task.FromResult(GetEvents(s, p))); - _readStoreManagerMock - .Setup(m => m.ReadModelType) - .Returns(typeof(TestReadModel)); - } - - [Test] - public async Task PurgeIsCalled() - { - // Act - await Sut.PurgeAsync(CancellationToken.None).ConfigureAwait(false); - - // Assert - _readModelStoreMock.Verify(s => s.DeleteAllAsync(It.IsAny()), Times.Once); - } - - [Test] - public async Task PopulateCallsApplyDomainEvents() - { - // Arrange - ArrangeEventStore(Many(6)); - - // Act - await Sut.PopulateAsync(CancellationToken.None).ConfigureAwait(false); - - // Assert - _readStoreManagerMock.Verify( - s => s.UpdateReadStoresAsync( - It.Is>(l => l.Count == 3), - It.IsAny()), - Times.Exactly(2)); - } - - [Test] - public async Task UnwantedEventsAreFiltered() - { - // Arrange - var events = new IAggregateEvent[] - { - A(), - A(), - A(), - }; - ArrangeEventStore(events); - - // Act - await Sut.PopulateAsync(CancellationToken.None).ConfigureAwait(false); - - // Assert - _readStoreManagerMock - .Verify( - s => s.UpdateReadStoresAsync( - It.Is>(l => l.Count == 2 && l.All(e => e.EventType == typeof(ThingyPingEvent))), - It.IsAny()), - Times.Once); - } - - private AllEventsPage GetEvents(GlobalPosition globalPosition, int pageSize) - { - var startPosition = globalPosition.IsStart - ? 1 - : int.Parse(globalPosition.Value); - - var events = _eventStoreData - .Skip(Math.Max(startPosition - 1, 0)) - .Take(pageSize) - .ToList(); - - var nextPosition = Math.Min(Math.Max(startPosition, 1) + pageSize, _eventStoreData.Count + 1); - - return new AllEventsPage(new GlobalPosition(nextPosition.ToString()), events); - } - - private void ArrangeEventStore(IEnumerable aggregateEvents) - { - ArrangeEventStore(aggregateEvents.Select(e => ToDomainEvent(e))); - } - - private void ArrangeEventStore(IEnumerable domainEvents) - { - _eventStoreData = domainEvents.ToList(); - } } } diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/ReadStoreManagerTestSuite.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/ReadStoreManagerTestSuite.cs index 7914981fe..04bc47f1b 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/ReadStoreManagerTestSuite.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/ReadStoreManagerTestSuite.cs @@ -41,9 +41,9 @@ namespace EventFlow.Tests.UnitTests.ReadStores { public abstract class ReadStoreManagerTestSuite : TestsFor - where T : IReadStoreManager + where T : IReadStoreManager { - protected Mock> ReadModelStoreMock { get; private set; } + protected Mock> ReadModelStoreMock { get; private set; } protected Mock ReadModelDomainEventApplierMock { get; private set; } protected IReadOnlyCollection AppliedDomainEvents { get; private set; } @@ -55,17 +55,17 @@ public void SetUpReadStoreManagerTestSuite() Mock(), new OptimisticConcurrencyRetryStrategy(new EventFlowConfiguration()))); - ReadModelStoreMock = InjectMock>(); + ReadModelStoreMock = InjectMock>(); ReadModelDomainEventApplierMock = InjectMock(); ReadModelDomainEventApplierMock .Setup(m => m.UpdateReadModelAsync( - It.IsAny(), + It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) .Callback< - TReadModel, + TestReadModel, IReadOnlyCollection, IReadModelContext, CancellationToken>((rm, d, c, _) => AppliedDomainEvents = d) @@ -78,9 +78,9 @@ public async Task ReadStoreIsUpdatedWithRelevantEvents() { // Arrange var thingyId = Inject(ThingyId.New); - Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( + Arrange_ReadModelStore_UpdateAsync(ReadModelEnvelope.With( thingyId.Value, - A())); + A())); var events = new[] { ToDomainEvent(A(), 1), @@ -98,15 +98,15 @@ public async Task ReadStoreIsUpdatedWithRelevantEvents() It.IsAny, - ReadModelEnvelope, + ReadModelEnvelope, CancellationToken, - Task>>>(), + Task>>>(), It.IsAny()), Times.Once); } protected IReadOnlyCollection Arrange_ReadModelStore_UpdateAsync( - params ReadModelEnvelope[] readModelEnvelopes) + params ReadModelEnvelope[] readModelEnvelopes) { // Don't try this at home... @@ -119,9 +119,9 @@ protected IReadOnlyCollection Arrange_ReadModelStore_Upda It.IsAny, - ReadModelEnvelope, + ReadModelEnvelope, CancellationToken, - Task>>>(), + Task>>>(), It.IsAny())) .Callback< IReadOnlyCollection, @@ -129,9 +129,9 @@ protected IReadOnlyCollection Arrange_ReadModelStore_Upda Func< IReadModelContext, IReadOnlyCollection, - ReadModelEnvelope, + ReadModelEnvelope, CancellationToken, - Task>>, + Task>>, CancellationToken>((readModelUpdates, readModelContextFactory, updaterFunc, cancellationToken) => { try diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/SingleAggregateReadStoreManagerTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/SingleAggregateReadStoreManagerTests.cs index 8fed0e4a1..ac0c37450 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/SingleAggregateReadStoreManagerTests.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/SingleAggregateReadStoreManagerTests.cs @@ -29,8 +29,8 @@ namespace EventFlow.Tests.UnitTests.ReadStores { [Category(Categories.Unit)] public class SingleAggregateReadStoreManagerTests : ReadStoreManagerTestSuite, - TReadModel>> + IReadModelStore, + TestReadModel>> { } } \ No newline at end of file diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs new file mode 100644 index 000000000..7a1688899 --- /dev/null +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs @@ -0,0 +1,20 @@ +using System.Threading; +using System.Threading.Tasks; +using EventFlow.Aggregates; +using EventFlow.ReadStores; +using EventFlow.TestHelpers.Aggregates; +using EventFlow.TestHelpers.Aggregates.Events; + +namespace EventFlow.Tests.UnitTests.ReadStores +{ + public class TestAsyncReadModel : IReadModel, IAmAsyncReadModelFor + { + public Task ApplyAsync( + IReadModelContext context, + IDomainEvent domainEvent, + CancellationToken cancellationToken ) + { + return Task.Delay( 0, cancellationToken ); + } + } +} \ No newline at end of file diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/TReadModel.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/TestReadModel.cs similarity index 97% rename from Source/EventFlow.Tests/UnitTests/ReadStores/TReadModel.cs rename to Source/EventFlow.Tests/UnitTests/ReadStores/TestReadModel.cs index 3430bf6e2..14cfe3c3b 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/TReadModel.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/TestReadModel.cs @@ -28,7 +28,7 @@ namespace EventFlow.Tests.UnitTests.ReadStores { - public class TReadModel : IReadModel, + public class TestReadModel : IReadModel, IAmReadModelFor { public void Apply(IReadModelContext context, IDomainEvent domainEvent) From d54f1aba52fffff533fd1900589b616c412dba3f Mon Sep 17 00:00:00 2001 From: Jack Herring Date: Sun, 9 Jun 2019 16:51:40 +0100 Subject: [PATCH 2/6] Fix tests --- Source/EventFlow/ReadStores/ReadModelPopulator.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/EventFlow/ReadStores/ReadModelPopulator.cs b/Source/EventFlow/ReadStores/ReadModelPopulator.cs index e0dfa623a..3752d5fc9 100644 --- a/Source/EventFlow/ReadStores/ReadModelPopulator.cs +++ b/Source/EventFlow/ReadStores/ReadModelPopulator.cs @@ -98,10 +98,17 @@ public async Task PopulateAsync( var stopwatch = Stopwatch.StartNew(); var readStoreManagers = ResolveReadStoreManagers(readModelType); + var readModelTypes = new[] + { + typeof( IAmReadModelFor<,,> ), + typeof( IAmAsyncReadModelFor<,,> ) + }; + var aggregateEventTypes = new HashSet(readModelType .GetTypeInfo() .GetInterfaces() - .Where(i => i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == typeof(IAmReadModelFor<,,>)) + .Where(i => i.GetTypeInfo().IsGenericType + && readModelTypes.Contains(i.GetGenericTypeDefinition())) .Select(i => i.GetTypeInfo().GetGenericArguments()[2])); _log.Verbose(() => string.Format( From 7d438ae3261d563dc873836dc3d89a27bf618fd7 Mon Sep 17 00:00:00 2001 From: Rasmus Mikkelsen Date: Tue, 11 Jun 2019 21:25:30 +0200 Subject: [PATCH 3/6] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index bb98b8569..aafbb4173 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -33,6 +33,7 @@ ``` * Fix: ASP.NET Core `AddRequestHeadersMetadataProvider` doesn't throw when HttpContext is null. +* Fix: `ReadModelRepopulator` now correctly populates `IAmAsyncReadModelFor` ### New in 0.72.3914 (released 2019-05-28) From 1b79f318593b345ee2dc73899facc3750e45c633 Mon Sep 17 00:00:00 2001 From: Rasmus Mikkelsen Date: Tue, 11 Jun 2019 21:27:15 +0200 Subject: [PATCH 4/6] Add missing header --- .../ReadStores/BaseReadModelTests.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs index 89f47bae6..89f75883f 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/BaseReadModelTests.cs @@ -1,4 +1,27 @@ -using System; +// The MIT License (MIT) +// +// Copyright (c) 2015-2019 Rasmus Mikkelsen +// Copyright (c) 2015-2019 eBay Software Foundation +// https://github.com/eventflow/EventFlow +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -134,4 +157,4 @@ private void ArrangeEventStore(IEnumerable domainEvents) _eventStoreData = domainEvents.ToList(); } } -} \ No newline at end of file +} From 927ba0dad9a95412dca73a15d9868a7702b0c894 Mon Sep 17 00:00:00 2001 From: Rasmus Mikkelsen Date: Tue, 11 Jun 2019 21:27:32 +0200 Subject: [PATCH 5/6] Add missing header --- .../AsyncReadModelPopulatorTests.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs index 23d793f78..a21fae2b5 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/AsyncReadModelPopulatorTests.cs @@ -1,6 +1,29 @@ -namespace EventFlow.Tests.UnitTests.ReadStores +// The MIT License (MIT) +// +// Copyright (c) 2015-2019 Rasmus Mikkelsen +// Copyright (c) 2015-2019 eBay Software Foundation +// https://github.com/eventflow/EventFlow +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +namespace EventFlow.Tests.UnitTests.ReadStores { public class AsyncReadModelPopulatorTests : BaseReadModelTests { } -} \ No newline at end of file +} From 52220024638f64dd43f9af2a19dd5744dc124800 Mon Sep 17 00:00:00 2001 From: Rasmus Mikkelsen Date: Tue, 11 Jun 2019 21:27:58 +0200 Subject: [PATCH 6/6] Add missing header --- .../ReadStores/TestAsyncReadModel.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs b/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs index 7a1688899..e824155dc 100644 --- a/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs +++ b/Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs @@ -1,4 +1,27 @@ -using System.Threading; +// The MIT License (MIT) +// +// Copyright (c) 2015-2019 Rasmus Mikkelsen +// Copyright (c) 2015-2019 eBay Software Foundation +// https://github.com/eventflow/EventFlow +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +using System.Threading; using System.Threading.Tasks; using EventFlow.Aggregates; using EventFlow.ReadStores; @@ -17,4 +40,4 @@ public Task ApplyAsync( return Task.Delay( 0, cancellationToken ); } } -} \ No newline at end of file +}