├── .gitattributes ├── .gitignore ├── .nuget ├── NuGet.Config ├── NuGet.targets └── nuget.exe ├── LICENSE.txt ├── README.md ├── docs ├── backlog.md └── images │ └── TestSpecificationStatechart.png ├── lib ├── geteventstore_integration.proj └── packages.config ├── linuxbuild ├── mono-build.proj ├── mono-info.proj └── mono-version.proj ├── src ├── .nuget │ └── packages.config ├── Core │ ├── AggregateSource.Content.ExplicitRouting │ │ ├── AggregateRootEntity.cs │ │ ├── AggregateRootEntityTests.cs │ │ ├── AggregateSource.Content.ExplicitRouting.csproj │ │ ├── Entity.cs │ │ ├── EntityTests.cs │ │ ├── GlobalSuppressions.cs │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ └── Resources.resx │ │ └── packages.config │ ├── AggregateSource.Content.ExplicitStateExplicitRouting │ │ ├── AggregateRootEntity.cs │ │ ├── AggregateRootEntityTests.cs │ │ ├── AggregateSource.Content.ExplicitStateExplicitRouting.csproj │ │ ├── Entity.cs │ │ ├── EntityState.cs │ │ ├── EntityStateTests.cs │ │ ├── EntityTests.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── AggregateSource.Tests │ │ ├── AggregateBuilderTests.cs │ │ ├── AggregateNotFoundExceptionTests.cs │ │ ├── AggregateRootEntityStub.cs │ │ ├── AggregateSource.Tests.csproj │ │ ├── AggregateSourceExceptionTests.cs │ │ ├── AggregateStubs.cs │ │ ├── AggregateTests.cs │ │ ├── ConcurrentUnitOfWorkTests.cs │ │ ├── EventRecorderTests.cs │ │ ├── FactTests.cs │ │ ├── GlobalSuppressions.cs │ │ ├── InstanceEventRouterTests.cs │ │ ├── OptionalTests.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── StaticEventRouterTests.cs │ │ ├── TestFactBuilder.cs │ │ ├── UnitOfWorkTests.cs │ │ └── packages.config │ ├── AggregateSource.sln │ ├── AggregateSource.sln.DotSettings │ └── AggregateSource │ │ ├── Aggregate.cs │ │ ├── AggregateBuilder.cs │ │ ├── AggregateNotFoundException.cs │ │ ├── AggregateSource.csproj │ │ ├── AggregateSourceException.cs │ │ ├── ConcurrentUnitOfWork.cs │ │ ├── EventRecorder.cs │ │ ├── Fact.cs │ │ ├── GlobalSuppressions.cs │ │ ├── IAggregateChangeTracker.cs │ │ ├── IAggregateInitializer.cs │ │ ├── IAggregateRootEntity.cs │ │ ├── IAsyncRepository.cs │ │ ├── IConfigureInstanceEventRouter.cs │ │ ├── IConfigureStaticEventRouter.cs │ │ ├── IInstanceEventRouter.cs │ │ ├── IRepository.cs │ │ ├── ISnapshotable.cs │ │ ├── IStaticEventRouter.cs │ │ ├── InstanceEventRouter.cs │ │ ├── Optional.cs │ │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ │ ├── README.md │ │ ├── StaticEventRouter.cs │ │ └── UnitOfWork.cs ├── EventStore │ ├── AggregateSource.EventStore.IntegratedTests │ │ ├── AggregateSource.EventStore.IntegratedTests.csproj │ │ ├── AsyncRepositoryTests.cs │ │ ├── Framework │ │ │ ├── AggregateRootEntityStub.cs │ │ │ ├── AssemblyAttribute.cs │ │ │ ├── Catch.cs │ │ │ ├── EmbeddedEventStore.cs │ │ │ ├── EventDeserializer.cs │ │ │ ├── EventReaderConfigurationFactory.cs │ │ │ ├── EventStoreConnectionExtensions.cs │ │ │ ├── EventStoreIntegrationAttribute.cs │ │ │ ├── EventStub.cs │ │ │ ├── IBinaryDeserializer.cs │ │ │ ├── IBinarySerializer.cs │ │ │ ├── RepositoryScenarioBuilder.cs │ │ │ └── Snapshots │ │ │ │ ├── AsyncSnapshotReaderFactory.cs │ │ │ │ ├── SnapshotDeserializer.cs │ │ │ │ ├── SnapshotReaderConfigurationFactory.cs │ │ │ │ ├── SnapshotReaderFactory.cs │ │ │ │ ├── SnapshotStateStub.cs │ │ │ │ └── SnapshotStreamNameResolver.cs │ │ ├── Model.cs │ │ ├── NLog.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RepositoryTests.cs │ │ ├── Snapshots │ │ │ ├── AsyncSnapshotReaderTests.cs │ │ │ ├── AsyncSnapshotableRepositoryTests.cs │ │ │ ├── Framework │ │ │ │ └── SnapshotStoreReadConfigurationFactory.cs │ │ │ ├── SnapshotReaderTests.cs │ │ │ ├── SnapshotableAggregateRootEntityStub.cs │ │ │ └── SnapshotableRepositoryTests.cs │ │ ├── app.config │ │ └── packages.config │ ├── AggregateSource.EventStore.Tests │ │ ├── AggregateSource.EventStore.Tests.csproj │ │ ├── Builders │ │ │ ├── EventReaderConfigurationBuilder.cs │ │ │ ├── SnapshotBuilder.cs │ │ │ └── SnapshotReaderConfigurationBuilder.cs │ │ ├── EventReaderConfigurationTests.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Resolvers │ │ │ ├── FixedStreamUserCredentialsResolverTests.cs │ │ │ ├── NoStreamUserCredentialsResolverTests.cs │ │ │ └── PassThroughStreamNameResolverTests.cs │ │ ├── Snapshots │ │ │ ├── SnapshotReaderConfigurationTests.cs │ │ │ └── SnapshotTests.cs │ │ ├── Stubs │ │ │ ├── StubbedEventDeserializer.cs │ │ │ ├── StubbedSnapshotDeserializer.cs │ │ │ ├── StubbedStreamNameResolver.cs │ │ │ └── StubbedStreamUserCredentialsResolver.cs │ │ └── packages.config │ ├── AggregateSource.EventStore.sln │ ├── AggregateSource.EventStore.sln.DotSettings │ └── AggregateSource.EventStore │ │ ├── AggregateSource.EventStore.csproj │ │ ├── AsyncRepository.cs │ │ ├── EventReaderConfiguration.cs │ │ ├── IEventDeserializer.cs │ │ ├── IStreamNameResolver.cs │ │ ├── IStreamUserCredentialsResolver.cs │ │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ │ ├── Repository.cs │ │ ├── Resolvers │ │ ├── FixedStreamUserCredentialsResolver.cs │ │ ├── NoStreamUserCredentialsResolver.cs │ │ └── PassThroughStreamNameResolver.cs │ │ ├── SliceSize.cs │ │ ├── Snapshots │ │ ├── AsyncSnapshotReader.cs │ │ ├── AsyncSnapshotableRepository.cs │ │ ├── IAsyncSnapshotReader.cs │ │ ├── ISnapshotDeserializer.cs │ │ ├── ISnapshotReader.cs │ │ ├── Snapshot.cs │ │ ├── SnapshotReader.cs │ │ ├── SnapshotReaderConfiguration.cs │ │ └── SnapshotableRepository.cs │ │ └── packages.config ├── NEventStore │ ├── .nuget │ │ └── packages.config │ ├── AggregateSource.NEventStore.Tests │ │ ├── AggregateSource.NEventStore.Tests.csproj │ │ ├── Framework │ │ │ ├── AggregateRootEntityStub.cs │ │ │ ├── Catch.cs │ │ │ ├── EventStub.cs │ │ │ ├── RepositoryScenarioBuilder.cs │ │ │ └── Snapshots │ │ │ │ ├── SnapshotStateStub.cs │ │ │ │ └── SnapshotableAggregateRootEntityStub.cs │ │ ├── Model.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RepositoryTests.cs │ │ ├── Snapshots │ │ │ └── SnapshotableRepositoryTests.cs │ │ └── packages.config │ ├── AggregateSource.NEventStore.sln │ ├── AggregateSource.NEventStore.sln.DotSettings │ └── AggregateSource.NEventStore │ │ ├── AggregateSource.NEventStore.csproj │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Repository.cs │ │ ├── Snapshots │ │ └── SnapshotableRepository.cs │ │ └── packages.config ├── Reactive │ ├── AggregateSource.Reactive.Tests │ │ ├── AggregateSource.Reactive.Tests.csproj │ │ ├── ObservableAggregateRootEntityTests.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── AggregateSource.Reactive.sln │ ├── AggregateSource.Reactive.sln.DotSettings │ └── AggregateSource.Reactive │ │ ├── AggregateSource.Reactive.csproj │ │ ├── IObservableAggregateRootEntity.cs │ │ ├── ObservableAggregateRootEntity.cs │ │ └── Properties │ │ └── AssemblyInfo.cs ├── Recipes │ └── EventStoreShopping │ │ ├── EventStoreShopping.sln │ │ └── EventStoreShopping │ │ ├── AggregateRootEntity.cs │ │ ├── App.config │ │ ├── Entity.cs │ │ ├── EventStoreShopping.csproj │ │ ├── Messaging │ │ ├── Commands │ │ │ ├── AddItemToCart.cs │ │ │ ├── Checkout.cs │ │ │ ├── DecrementItemInCart.cs │ │ │ ├── IncrementItemInCart.cs │ │ │ ├── RemoveItemFromCart.cs │ │ │ └── StartShopping.cs │ │ └── Events │ │ │ ├── AddedItemToCart.cs │ │ │ ├── CheckedoutCart.cs │ │ │ ├── DecrementedItemCountInCart.cs │ │ │ ├── IncrementedItemCountInCart.cs │ │ │ ├── RemovedItemFromCart.cs │ │ │ └── StartedShopping.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Shopping │ │ ├── ItemId.cs │ │ ├── ShoppingCart.cs │ │ ├── ShoppingCartAlreadyCheckedOutException.cs │ │ ├── ShoppingCartDoesNotContainItemException.cs │ │ └── ShoppingCartId.cs │ │ └── packages.config ├── SampleSource │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SampleSource.csproj │ ├── SampleSource.sln │ ├── Testing │ │ ├── AggregateAsSystemUnderTest.cs │ │ └── UsingIdFromIEvent.cs │ ├── UsingDomainEvents.cs │ ├── UsingEntities.cs │ ├── UsingObjectInheritance.cs │ └── packages.config ├── SharedAssemblyInfo.cs ├── SharedVersionInfo.cs └── Testing │ ├── AggregateSource.Testing.NUnit │ ├── AggregateSource.Testing.NUnit.csproj │ ├── Content │ │ └── NUnitAssertionExtensions.cs │ ├── ExtensionsForCommandScenario.cs │ ├── ExtensionsForConstructorScenario.cs │ ├── ExtensionsForFactoryScenario.cs │ ├── ExtensionsForQueryScenario.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config │ ├── AggregateSource.Testing.Tests │ ├── AggregateRootEntityStub.cs │ ├── AggregateSource.Testing.Tests.csproj │ ├── CommandScenarioForTests.cs │ ├── Comparers │ │ ├── CompareNetObjectsBasedEventComparerTests.cs │ │ ├── CompareNetObjectsBasedExceptionComparerTests.cs │ │ ├── CompareNetObjectsBasedFactComparerTests.cs │ │ └── CompareNetObjectsBasedResultComparerTests.cs │ ├── ConstructorScenarioForTests.cs │ ├── EventCentricAggregateCommandTestRunnerTests.cs │ ├── EventCentricAggregateCommandTestSpecificationTests.cs │ ├── EventCentricAggregateConstructorTestRunnerTests.cs │ ├── EventCentricAggregateConstructorTestSpecificationTests.cs │ ├── EventCentricAggregateFactoryTestRunnerTests.cs │ ├── EventCentricAggregateFactoryTestSpecificationTests.cs │ ├── EventCentricTestSpecificationTests.cs │ ├── ExceptionCentricAggregateCommandTestRunnerTests.cs │ ├── ExceptionCentricAggregateCommandTestSpecificationTests.cs │ ├── ExceptionCentricAggregateConstructorTestRunnerTests.cs │ ├── ExceptionCentricAggregateConstructorTestSpecificationTests.cs │ ├── ExceptionCentricAggregateFactoryTestRunnerTests.cs │ ├── ExceptionCentricAggregateFactoryTestSpecificationTests.cs │ ├── ExceptionCentricAggregateQueryTestRunnerTests.cs │ ├── ExceptionCentricAggregateQueryTestSpecificationTests.cs │ ├── ExceptionCentricTestSpecificationTests.cs │ ├── FactoryScenarioForTests.cs │ ├── FactsBuilderTests.cs │ ├── Model.cs │ ├── NUnitExtensionsForCommandScenarioTests.cs │ ├── NUnitExtensionsForConstructorScenarioTests.cs │ ├── NUnitExtensionsForFactoryScenarioTests.cs │ ├── NUnitExtensionsForQueryScenarioTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── QueryScenarioForTests.cs │ ├── ResultCentricAggregateQueryTestRunnerTests.cs │ ├── ResultCentricAggregateQueryTestSpecificationTests.cs │ ├── ScenarioGivenStateBuilderTests.cs │ ├── ScenarioTests.cs │ ├── ScenarioThenStateBuilderTests.cs │ ├── ScenarioThrowStateBuilderTests.cs │ ├── ScenarioWhenStateBuilderTests.cs │ ├── TestSpecificationDataPointFixture.cs │ ├── TestSpecificationTextWriterTests.cs │ └── packages.config │ ├── AggregateSource.Testing.Xunit │ ├── AggregateSource.Testing.Xunit.csproj │ ├── Content │ │ └── XunitAssertionExtensions.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config │ ├── AggregateSource.Testing.sln │ ├── AggregateSource.Testing.sln.DotSettings │ └── AggregateSource.Testing │ ├── AggregateSource.Testing.csproj │ ├── Catch.cs │ ├── Command │ ├── AggregateCommandGivenNoneStateBuilder.cs │ ├── AggregateCommandGivenStateBuilder.cs │ ├── AggregateCommandThenNoneStateBuilder.cs │ ├── AggregateCommandThenStateBuilder.cs │ ├── AggregateCommandThrowStateBuilder.cs │ └── AggregateCommandWhenStateBuilder.cs │ ├── CommandScenarioFor.cs │ ├── Comparers │ ├── CompareNetObjectsBasedEventComparer.cs │ ├── CompareNetObjectsBasedExceptionComparer.cs │ ├── CompareNetObjectsBasedFactComparer.cs │ └── CompareNetObjectsBasedResultComparer.cs │ ├── Constructor │ ├── AggregateConstructorThenStateBuilder.cs │ └── AggregateConstructorThrowStateBuilder.cs │ ├── ConstructorScenarioFor.cs │ ├── EventCentricAggregateCommandTestResult.cs │ ├── EventCentricAggregateCommandTestRunner.cs │ ├── EventCentricAggregateCommandTestSpecification.cs │ ├── EventCentricAggregateConstructorTestResult.cs │ ├── EventCentricAggregateConstructorTestRunner.cs │ ├── EventCentricAggregateConstructorTestSpecification.cs │ ├── EventCentricAggregateFactoryTestResult.cs │ ├── EventCentricAggregateFactoryTestRunner.cs │ ├── EventCentricAggregateFactoryTestSpecification.cs │ ├── EventCentricAggregateQueryTestResult.cs │ ├── EventCentricTestResult.cs │ ├── EventCentricTestSpecification.cs │ ├── EventComparisonDifference.cs │ ├── ExceptionCentricAggregateCommandTestResult.cs │ ├── ExceptionCentricAggregateCommandTestRunner.cs │ ├── ExceptionCentricAggregateCommandTestSpecification.cs │ ├── ExceptionCentricAggregateConstructorTestResult.cs │ ├── ExceptionCentricAggregateConstructorTestRunner.cs │ ├── ExceptionCentricAggregateConstructorTestSpecification.cs │ ├── ExceptionCentricAggregateFactoryTestResult.cs │ ├── ExceptionCentricAggregateFactoryTestRunner.cs │ ├── ExceptionCentricAggregateFactoryTestSpecification.cs │ ├── ExceptionCentricAggregateQueryTestResult.cs │ ├── ExceptionCentricAggregateQueryTestRunner.cs │ ├── ExceptionCentricAggregateQueryTestSpecification.cs │ ├── ExceptionCentricTestResult.cs │ ├── ExceptionCentricTestSpecification.cs │ ├── ExceptionComparisonDifference.cs │ ├── FactComparisonDifference.cs │ ├── Factory │ ├── AggregateFactoryGivenNoneStateBuilder.cs │ ├── AggregateFactoryGivenStateBuilder.cs │ ├── AggregateFactoryThenNoneStateBuilder.cs │ ├── AggregateFactoryThenStateBuilder.cs │ ├── AggregateFactoryThrowStateBuilder.cs │ └── AggregateFactoryWhenStateBuilder.cs │ ├── FactoryScenarioFor.cs │ ├── FactsBuilder.cs │ ├── IAggregateCommandGivenNoneStateBuilder.cs │ ├── IAggregateCommandGivenStateBuilder.cs │ ├── IAggregateCommandInitialStateBuilder.cs │ ├── IAggregateCommandThenNoneStateBuilder.cs │ ├── IAggregateCommandThenStateBuilder.cs │ ├── IAggregateCommandThrowStateBuilder.cs │ ├── IAggregateCommandWhenStateBuilder.cs │ ├── IAggregateConstructorThenStateBuilder.cs │ ├── IAggregateConstructorThrowStateBuilder.cs │ ├── IAggregateConstructorWhenStateBuilder.cs │ ├── IAggregateFactoryGivenNoneStateBuilder.cs │ ├── IAggregateFactoryGivenStateBuilder.cs │ ├── IAggregateFactoryInitialStateBuilder.cs │ ├── IAggregateFactoryThenNoneStateBuilder.cs │ ├── IAggregateFactoryThenStateBuilder.cs │ ├── IAggregateFactoryThrowStateBuilder.cs │ ├── IAggregateFactoryWhenStateBuilder.cs │ ├── IAggregateQueryGivenNoneStateBuilder.cs │ ├── IAggregateQueryGivenStateBuilder.cs │ ├── IAggregateQueryInitialStateBuilder.cs │ ├── IAggregateQueryThenStateBuilder.cs │ ├── IAggregateQueryThrowStateBuilder.cs │ ├── IAggregateQueryWhenStateBuilder.cs │ ├── IEventCentricAggregateCommandTestRunner.cs │ ├── IEventCentricAggregateCommandTestSpecificationBuilder.cs │ ├── IEventCentricAggregateConstructorTestRunner.cs │ ├── IEventCentricAggregateConstructorTestSpecificationBuilder.cs │ ├── IEventCentricAggregateFactoryTestRunner.cs │ ├── IEventCentricAggregateFactoryTestSpecificationBuilder.cs │ ├── IEventCentricTestSpecificationBuilder.cs │ ├── IEventCentricTestSpecificationRunner.cs │ ├── IEventCentricTestSpecificationWriter.cs │ ├── IEventComparer.cs │ ├── IExceptionCentricAggregateCommandTestRunner.cs │ ├── IExceptionCentricAggregateCommandTestSpecificationBuilder.cs │ ├── IExceptionCentricAggregateConstructorTestRunner.cs │ ├── IExceptionCentricAggregateConstructorTestSpecificationBuilder.cs │ ├── IExceptionCentricAggregateFactoryTestRunner.cs │ ├── IExceptionCentricAggregateFactoryTestSpecificationBuilder.cs │ ├── IExceptionCentricAggregateQueryTestRunner.cs │ ├── IExceptionCentricAggregateQueryTestSpecificationBuilder.cs │ ├── IExceptionCentricTestSpecificationBuilder.cs │ ├── IExceptionCentricTestSpecificationRunner.cs │ ├── IExceptionCentricTestSpecificationWriter.cs │ ├── IExceptionComparer.cs │ ├── IFactComparer.cs │ ├── IResultCentricAggregateQueryTestRunner.cs │ ├── IResultCentricAggregateQueryTestSpecificationBuilder.cs │ ├── IResultComparer.cs │ ├── IScenarioGivenNoneStateBuilder.cs │ ├── IScenarioGivenStateBuilder.cs │ ├── IScenarioInitialStateBuilder.cs │ ├── IScenarioThenNoneStateBuilder.cs │ ├── IScenarioThenStateBuilder.cs │ ├── IScenarioThrowStateBuilder.cs │ ├── IScenarioWhenStateBuilder.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Query │ ├── AggregateQueryGivenNoneStateBuilder.cs │ ├── AggregateQueryGivenStateBuilder.cs │ ├── AggregateQueryThenStateBuilder.cs │ ├── AggregateQueryThrowStateBuilder.cs │ └── AggregateQueryWhenStateBuilder.cs │ ├── QueryScenarioFor.cs │ ├── README.md │ ├── ResultCentricAggregateQueryTestRunner.cs │ ├── ResultCentricAggregateQueryTestSpecification.cs │ ├── ResultComparisonDifference.cs │ ├── Scenario.cs │ ├── State.cs │ ├── TestResultState.cs │ ├── TestSpecificationBuilder.cs │ ├── TestSpecificationBuilderContext.cs │ ├── TestSpecificationTextWriter.cs │ ├── WrappedEventComparerEqualityComparer.cs │ └── packages.config ├── win_run_me_first.bat ├── win_run_me_right_off_the.bat └── winbuild ├── TransformProjectToNET40.xslt ├── build.proj ├── ci.proj ├── info.proj ├── master_version.txt ├── nuget.proj ├── nuspec ├── AggregateSource.Content.ExplicitRouting.nuspec ├── AggregateSource.Content.ExplicitStateExplicitRouting.nuspec ├── AggregateSource.EventStore.nuspec ├── AggregateSource.NEventStore.nuspec ├── AggregateSource.Testing.NUnit.nuspec ├── AggregateSource.Testing.Xunit.nuspec ├── AggregateSource.Testing.nuspec └── AggregateSource.nuspec ├── packages.config ├── run_build.bat ├── run_cibuild.bat ├── run_me_first.proj ├── run_pack.bat ├── run_push.bat ├── run_test.bat ├── test.proj └── version.proj /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yreynhout/AggregateSource/7c9f5eeaf714ae51edad8a383c80e5090347d0e0/.nuget/nuget.exe -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | ==================== 3 | 4 | Copyright (c) 2013, Yves Reynhout 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 11 | Neither the name of the BitTacklr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /docs/backlog.md: -------------------------------------------------------------------------------- 1 | # Non functional issues 2 | 3 | - ~~Fix broken build~~ 4 | - ~~Add a license~~ 5 | - ~~Build file~~ 6 | - ~~Test build on TeamCity~~ 7 | - ~~NuSpec~~ 8 | 9 | # Functional issues 10 | 11 | ## To complete 12 | 13 | - Extra tests that prove that an identifier can't be null (repository) 14 | - Complete tests for test result 15 | - Complete tests for aggregate scenario test specification infrastructure 16 | - Factory tests are missing 17 | - ThrowsFixture is missing for all 18 | - Usage of indented text writer as the text writer for specifications and results 19 | 20 | ## Features 21 | 22 | - ~~[DESIGN] Replace Guid by String as identifier (supersedes)~~ 23 | - ~~[DESIGN] Support both Guid and String as identifier - using conditional compilation~~ 24 | - ~~[DESIGN] Support both Guid and String as identifier - using yet another abstraction~~ 25 | - ~~[DESIGN] The asynchronous repository~~ 26 | - ~~[DESIGN] Snapshotting~~ 27 | - [DESIGN] StreamSource - Writing to sql 28 | - [DESIGN] StreamSource - Reading from sql 29 | - [DESIGN] StreamSource - Readonly resource oriented API using Nancy 30 | - Extend SampleSource with an async sample. 31 | - DRY up those repos, there's a SlicedEventStreamReader in them (bonus, we can test this thing separately). 32 | - Build a realistic app on top of this API that shows off entities, aggregates, testing, bulk loading. 33 | 34 | ## Ideas 35 | 36 | AggregateSource.Repositories 37 | 38 | AggregateSource.CollectionRepositories.EventStore 39 | AggregateSource.CollectionRepositories.NEventStore 40 | 41 | AggregateSource.PersistenceRepositories.EventStore 42 | AggregateSource.PersistenceRepositories.NEventStore 43 | -------------------------------------------------------------------------------- /docs/images/TestSpecificationStatechart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yreynhout/AggregateSource/7c9f5eeaf714ae51edad8a383c80e5090347d0e0/docs/images/TestSpecificationStatechart.png -------------------------------------------------------------------------------- /lib/geteventstore_integration.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\packages\MSBuildTasks.1.4.0.56\tools 5 | 6 | 7 | 8 | 9 | 13 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /lib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /linuxbuild/mono-build.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)/.. 5 | $(RootPath)/src 6 | 7 | 8 | 9 | 12 | 13 | 14 | 17 | 20 | 21 | 22 | 29 | 30 | -------------------------------------------------------------------------------- /linuxbuild/mono-info.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)/.. 5 | $(RootPath)/src 6 | $(MSBuildProjectDirectory)/packages 7 | $(PackagesPath)/MSBuildTasks.1.4.0.56/tools 8 | 9 | 10 | 11 | 12 | 15 | 16 | 28 | 29 | -------------------------------------------------------------------------------- /linuxbuild/mono-version.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)/.. 5 | $(RootPath)/src 6 | $(MSBuildProjectDirectory)/packages 7 | $(PackagesPath)/MSBuildTasks.1.4.0.56/tools 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | -------------------------------------------------------------------------------- /src/.nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/AggregateSource.Content.ExplicitRouting/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yreynhout/AggregateSource/7c9f5eeaf714ae51edad8a383c80e5090347d0e0/src/Core/AggregateSource.Content.ExplicitRouting/GlobalSuppressions.cs -------------------------------------------------------------------------------- /src/Core/AggregateSource.Content.ExplicitRouting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("AggregateSource")] 5 | [assembly: 6 | AssemblyDescription( 7 | "AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model." 8 | )] -------------------------------------------------------------------------------- /src/Core/AggregateSource.Content.ExplicitRouting/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/AggregateSource.Content.ExplicitStateExplicitRouting/EntityState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Base class for aggregate state objects that need some basic infrastructure for routing events to handlers. 7 | /// 8 | public abstract class EntityState : IInstanceEventRouter 9 | { 10 | readonly InstanceEventRouter _router; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | protected EntityState() 16 | { 17 | _router = new InstanceEventRouter(); 18 | } 19 | 20 | /// 21 | /// Registers the state handler to be invoked when the specified event is applied. 22 | /// 23 | /// The type of the event to register the handler for. 24 | /// The handler. 25 | /// Thrown when the is null. 26 | protected void Register(Action handler) 27 | { 28 | if (handler == null) throw new ArgumentNullException("handler"); 29 | _router.ConfigureRoute(handler); 30 | } 31 | 32 | /// 33 | /// Routes the specified to a configured state handler, if any. 34 | /// 35 | /// The event to route. 36 | /// Thrown when the is null. 37 | public void Route(object @event) 38 | { 39 | if (@event == null) throw new ArgumentNullException("event"); 40 | _router.Route(@event); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource.Content.ExplicitStateExplicitRouting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("AggregateSource")] 5 | [assembly: 6 | AssemblyDescription( 7 | "AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model." 8 | )] -------------------------------------------------------------------------------- /src/Core/AggregateSource.Content.ExplicitStateExplicitRouting/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/AggregateSource.Tests/AggregateRootEntityStub.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource 2 | { 3 | public class AggregateRootEntityStub : AggregateRootEntity 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource.Tests/AggregateStubs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource 4 | { 5 | public static class AggregateStubs 6 | { 7 | static readonly Random Random = new Random(); 8 | 9 | public static readonly Aggregate Stub1 = 10 | Create("Stub/123", new AggregateRootEntityStub()); 11 | 12 | public static readonly Aggregate Stub2 = 13 | Create("Stub/456", new AggregateRootEntityStub()); 14 | 15 | public static Aggregate Create(TAggregateRoot root) 16 | where TAggregateRoot : IAggregateRootEntity 17 | { 18 | return new Aggregate("Stub/" + Random.Next(), 0, root); 19 | } 20 | 21 | public static Aggregate Create(string identifier, TAggregateRoot root) 22 | where TAggregateRoot : IAggregateRootEntity 23 | { 24 | return new Aggregate(identifier, 0, root); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource.Tests/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yreynhout/AggregateSource/7c9f5eeaf714ae51edad8a383c80e5090347d0e0/src/Core/AggregateSource.Tests/GlobalSuppressions.cs -------------------------------------------------------------------------------- /src/Core/AggregateSource.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("AggregateSource.Tests")] 5 | [assembly: 6 | AssemblyDescription( 7 | "AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model. Unit tests." 8 | )] -------------------------------------------------------------------------------- /src/Core/AggregateSource.Tests/TestFactBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace AggregateSource 5 | { 6 | class TestFactBuilder 7 | { 8 | readonly string _identifier; 9 | readonly object _event; 10 | 11 | public TestFactBuilder() 12 | { 13 | _identifier = new Random().Next().ToString(CultureInfo.CurrentCulture); 14 | _event = new object(); 15 | } 16 | 17 | TestFactBuilder(string identifier, object @event) 18 | { 19 | _identifier = identifier; 20 | _event = @event; 21 | } 22 | 23 | public TestFactBuilder WithEvent(object @event) 24 | { 25 | return new TestFactBuilder(_identifier, @event); 26 | } 27 | 28 | public TestFactBuilder WithIdentifier(string identifier) 29 | { 30 | return new TestFactBuilder(identifier, _event); 31 | } 32 | 33 | public Fact Build() 34 | { 35 | return new Fact(_identifier, _event); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/AggregateSource.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | False -------------------------------------------------------------------------------- /src/Core/AggregateSource/AggregateSourceException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace AggregateSource 5 | { 6 | /// 7 | /// Marker exception for this library from which all its exceptions derive. 8 | /// 9 | [Serializable] 10 | public class AggregateSourceException : Exception 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public AggregateSourceException() {} 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// The message that describes the error. 21 | public AggregateSourceException(string message) 22 | : base(message) {} 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The error message that explains the reason for the exception. 28 | /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 29 | public AggregateSourceException(string message, Exception innerException) 30 | : base(message, innerException) {} 31 | 32 | /// 33 | /// Initializes a new instance of the class. 34 | /// 35 | /// The that holds the serialized object data about the exception being thrown. 36 | /// The that contains contextual information about the source or destination. 37 | protected AggregateSourceException(SerializationInfo info, StreamingContext context) : base(info, context) {} 38 | } 39 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yreynhout/AggregateSource/7c9f5eeaf714ae51edad8a383c80e5090347d0e0/src/Core/AggregateSource/GlobalSuppressions.cs -------------------------------------------------------------------------------- /src/Core/AggregateSource/IAggregateChangeTracker.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Tracks changes that happen to an aggregate 7 | /// 8 | public interface IAggregateChangeTracker 9 | { 10 | /// 11 | /// Determines whether this instance has state changes. 12 | /// 13 | /// 14 | /// true if this instance has state changes; otherwise, false. 15 | /// 16 | bool HasChanges(); 17 | 18 | /// 19 | /// Gets the state changes applied to this instance. 20 | /// 21 | /// A list of recorded state changes. 22 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] 23 | IEnumerable GetChanges(); 24 | 25 | /// 26 | /// Clears the state changes. 27 | /// 28 | void ClearChanges(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IAggregateInitializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Initializes an aggregate. 7 | /// 8 | public interface IAggregateInitializer 9 | { 10 | /// 11 | /// Initializes this instance using the specified events. 12 | /// 13 | /// The events to initialize with. 14 | /// Thrown when the are null. 15 | void Initialize(IEnumerable events); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IAggregateRootEntity.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource 2 | { 3 | /// 4 | /// Aggregate root entity marker interface. 5 | /// 6 | public interface IAggregateRootEntity : IAggregateInitializer, IAggregateChangeTracker {} 7 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IAsyncRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Represents an asynchronous, virtual collection of . 7 | /// 8 | /// The type of the aggregate root in this collection. 9 | public interface IAsyncRepository 10 | { 11 | /// 12 | /// Gets the aggregate root entity associated with the specified aggregate identifier. 13 | /// 14 | /// The aggregate identifier. 15 | /// An instance of . 16 | /// Thrown when an aggregate is not found. 17 | Task GetAsync(string identifier); 18 | 19 | /// 20 | /// Attempts to get the aggregate root entity associated with the aggregate identifier. 21 | /// 22 | /// The aggregate identifier. 23 | /// The found , or empty if not found. 24 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] 25 | Task> GetOptionalAsync(string identifier); 26 | 27 | /// 28 | /// Adds the aggregate root entity to this collection using the specified aggregate identifier. 29 | /// 30 | /// The aggregate identifier. 31 | /// The aggregate root entity. 32 | void Add(string identifier, TAggregateRoot root); 33 | } 34 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IConfigureInstanceEventRouter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Configures an instance event router with state handlers events can be routed to. 7 | /// 8 | public interface IConfigureInstanceEventRouter : IInstanceEventRouter 9 | { 10 | /// 11 | /// Adds a route for the specified event type to the specified state handler. 12 | /// 13 | /// The event type the route is for. 14 | /// The state handler that should be invoked when an event of the specified type is routed. 15 | /// Thrown when or is null. 16 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "event")] 17 | void ConfigureRoute(Type @event, Action handler); 18 | 19 | /// 20 | /// Adds a route for the specified event type to the specified state handler. 21 | /// 22 | /// The event type the route is for. 23 | /// The state handler that should be invoked when an event of the specified type is routed. 24 | /// Thrown when is null. 25 | void ConfigureRoute(Action handler); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IConfigureStaticEventRouter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Configures a static event router with state handlers events can be routed to. 7 | /// 8 | public interface IConfigureStaticEventRouter : IStaticEventRouter 9 | { 10 | /// 11 | /// Adds a route for the specified event type to the specified state handler. 12 | /// 13 | /// The instance type this route is for. 14 | /// The event type this route is for. 15 | /// The state handler that should be invoked when an event of the specified type is routed to an instance of the specified type. 16 | /// Thrown when is null. 17 | void ConfigureRoute(Action handler); 18 | 19 | /// 20 | /// Adds a route for the specified event type to the specified state handler. 21 | /// 22 | /// The instance type the route is for. 23 | /// The event type the route is for. 24 | /// The state handler that should be invoked when an event of the specified type is routed. 25 | /// Thrown when or or is null. 26 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "event")] 27 | void ConfigureRoute(Type instance, Type @event, Action handler); 28 | } 29 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IInstanceEventRouter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Routes an event to a configured state handler. 7 | /// 8 | public interface IInstanceEventRouter 9 | { 10 | /// 11 | /// Routes the specified to a configured state handler, if any. 12 | /// 13 | /// The event to route. 14 | /// Thrown when the is null. 15 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "event")] 16 | void Route(object @event); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IRepository.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource 2 | { 3 | /// 4 | /// Represents a virtual collection of . 5 | /// 6 | /// The type of the aggregate root in this collection. 7 | public interface IRepository 8 | { 9 | /// 10 | /// Gets the aggregate root entity associated with the specified aggregate identifier. 11 | /// 12 | /// The aggregate identifier. 13 | /// An instance of . 14 | /// Thrown when an aggregate is not found. 15 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] 16 | TAggregateRoot Get(string identifier); 17 | 18 | /// 19 | /// Attempts to get the aggregate root entity associated with the aggregate identifier. 20 | /// 21 | /// The aggregate identifier. 22 | /// The found , or empty if not found. 23 | Optional GetOptional(string identifier); 24 | 25 | /// 26 | /// Adds the aggregate root entity to this collection using the specified aggregate identifier. 27 | /// 28 | /// The aggregate identifier. 29 | /// The aggregate root entity. 30 | void Add(string identifier, TAggregateRoot root); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/ISnapshotable.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource 2 | { 3 | /// 4 | /// Represents the snapshotting operations on an aggregate root entity. 5 | /// 6 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Snapshotable")] 7 | public interface ISnapshotable 8 | { 9 | /// 10 | /// Restores a snapshot using the specified object. 11 | /// 12 | /// The state object to restore the snapshot from. 13 | void RestoreSnapshot(object state); 14 | 15 | /// 16 | /// Takes a snapshot of the aggregate root entity. 17 | /// 18 | /// The state object that represents the snapshot. 19 | object TakeSnapshot(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/IStaticEventRouter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource 4 | { 5 | /// 6 | /// Routes an event to a configured state handler. 7 | /// 8 | public interface IStaticEventRouter 9 | { 10 | /// 11 | /// Routes the specified to a configured state handler, if any, on the specified . 12 | /// 13 | /// The instance to route to. 14 | /// The event to route. 15 | /// Thrown when the or is null. 16 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "event")] 17 | void Route(object instance, object @event); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Core/AggregateSource/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | 4 | [assembly: AssemblyTitle("AggregateSource")] 5 | [assembly: 6 | AssemblyDescription( 7 | "AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model." 8 | )] 9 | [assembly: NeutralResourcesLanguageAttribute("en")] 10 | -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/AggregateRootEntityStub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace AggregateSource.EventStore.Framework 6 | { 7 | public class AggregateRootEntityStub : AggregateRootEntity 8 | { 9 | public static readonly Func Factory = () => new AggregateRootEntityStub(); 10 | 11 | readonly List _recordedEvents; 12 | 13 | public AggregateRootEntityStub() 14 | { 15 | _recordedEvents = new List(); 16 | 17 | Register(_ => _recordedEvents.Add(_)); 18 | } 19 | 20 | public IList RecordedEvents 21 | { 22 | get { return new ReadOnlyCollection(_recordedEvents); } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/AssemblyAttribute.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Framework; 2 | 3 | [assembly: EventStoreIntegration] -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Catch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace AggregateSource.EventStore.Framework 5 | { 6 | public static class Catch 7 | { 8 | public static void ExceptionOf(Action action) 9 | { 10 | // ReSharper disable EmptyGeneralCatchClause 11 | try 12 | { 13 | action(); 14 | } 15 | catch {} 16 | // ReSharper restore EmptyGeneralCatchClause 17 | } 18 | 19 | public static async Task ExceptionOf(Func action) 20 | { 21 | // ReSharper disable EmptyGeneralCatchClause 22 | try 23 | { 24 | await action(); 25 | } 26 | catch { } 27 | // ReSharper restore EmptyGeneralCatchClause 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/EmbeddedEventStore.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using EventStore.ClientAPI; 3 | using EventStore.ClientAPI.Embedded; 4 | using EventStore.ClientAPI.SystemData; 5 | using EventStore.Core; 6 | using EventStore.Core.Data; 7 | 8 | namespace AggregateSource.EventStore.Framework 9 | { 10 | public static class EmbeddedEventStore 11 | { 12 | public static void Start() 13 | { 14 | var node = EmbeddedVNodeBuilder. 15 | AsSingleNode(). 16 | OnDefaultEndpoints(). 17 | RunInMemory(). 18 | Build(); 19 | node.Start(); 20 | node.StartAndWaitUntilReady().Wait(); 21 | Node = node; 22 | Credentials = new UserCredentials("admin", "changeit"); 23 | var settings = ConnectionSettings.Create() 24 | .SetDefaultUserCredentials(Credentials) 25 | .KeepReconnecting() 26 | .KeepRetrying() 27 | .UseConsoleLogger() 28 | .Build(); 29 | var connection = EmbeddedEventStoreConnection.Create(Node, settings); 30 | connection.ConnectAsync().Wait(); 31 | Connection = connection; 32 | } 33 | 34 | public static void Stop() 35 | { 36 | var connection = Connection; 37 | if (connection != null) 38 | { 39 | connection.Close(); 40 | connection.Dispose(); 41 | Connection = null; 42 | } 43 | var node = Node; 44 | if (node != null) 45 | { 46 | node.Stop(); 47 | Node = null; 48 | } 49 | Credentials = null; 50 | } 51 | 52 | public static ClusterVNode Node { get; private set; } 53 | 54 | public static IEventStoreConnection Connection { get; private set; } 55 | 56 | public static UserCredentials Credentials { get; private set; } 57 | } 58 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/EventDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using EventStore.ClientAPI; 5 | 6 | namespace AggregateSource.EventStore.Framework 7 | { 8 | public class EventDeserializer : IEventDeserializer 9 | { 10 | public IEnumerable Deserialize(ResolvedEvent resolvedEvent) 11 | { 12 | var instance = 13 | (IBinaryDeserializer) 14 | Activator.CreateInstance(Type.GetType(resolvedEvent.OriginalEvent.EventType, true)); 15 | using (var stream = new MemoryStream(resolvedEvent.Event.Data)) 16 | { 17 | using (var reader = new BinaryReader(stream)) 18 | { 19 | instance.Read(reader); 20 | } 21 | } 22 | yield return instance; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/EventReaderConfigurationFactory.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Resolvers; 2 | using EventStore.ClientAPI.SystemData; 3 | 4 | namespace AggregateSource.EventStore.Framework 5 | { 6 | public static class EventReaderConfigurationFactory 7 | { 8 | public static EventReaderConfiguration Create() 9 | { 10 | return new EventReaderConfiguration(new SliceSize(1), new EventDeserializer(), 11 | new PassThroughStreamNameResolver(), 12 | new FixedStreamUserCredentialsResolver(new UserCredentials("admin", 13 | "changeit"))); 14 | } 15 | 16 | public static EventReaderConfiguration CreateWithResolver(IStreamNameResolver resolver) 17 | { 18 | return new EventReaderConfiguration(new SliceSize(1), new EventDeserializer(), resolver, 19 | new FixedStreamUserCredentialsResolver(new UserCredentials("admin", 20 | "changeit"))); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/EventStoreIntegrationAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using NUnit.Framework.Interfaces; 4 | 5 | namespace AggregateSource.EventStore.Framework 6 | { 7 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] 8 | public class EventStoreIntegrationAttribute : Attribute, ITestAction 9 | { 10 | public void BeforeTest(ITest test) 11 | { 12 | EmbeddedEventStore.Start(); 13 | } 14 | 15 | public void AfterTest(ITest test) 16 | { 17 | EmbeddedEventStore.Stop(); 18 | } 19 | 20 | public ActionTargets Targets 21 | { 22 | get { return ActionTargets.Suite; } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/EventStub.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace AggregateSource.EventStore.Framework 4 | { 5 | public class EventStub : IBinarySerializer, IBinaryDeserializer 6 | { 7 | int _value; 8 | 9 | public EventStub() {} 10 | 11 | public EventStub(int value) 12 | { 13 | _value = value; 14 | } 15 | 16 | public void Write(BinaryWriter writer) 17 | { 18 | writer.Write(_value); 19 | } 20 | 21 | public void Read(BinaryReader reader) 22 | { 23 | _value = reader.ReadInt32(); 24 | } 25 | 26 | public override bool Equals(object obj) 27 | { 28 | return Equals(obj as EventStub); 29 | } 30 | 31 | bool Equals(EventStub @event) 32 | { 33 | return !ReferenceEquals(@event, null) && _value.Equals(@event._value); 34 | } 35 | 36 | public override int GetHashCode() 37 | { 38 | unchecked 39 | { 40 | return _value.GetHashCode()*10 + 2; 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/IBinaryDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace AggregateSource.EventStore.Framework 4 | { 5 | public interface IBinaryDeserializer 6 | { 7 | void Read(BinaryReader reader); 8 | } 9 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/IBinarySerializer.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace AggregateSource.EventStore.Framework 4 | { 5 | public interface IBinarySerializer 6 | { 7 | void Write(BinaryWriter writer); 8 | } 9 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Snapshots/AsyncSnapshotReaderFactory.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Snapshots; 2 | using EventStore.ClientAPI; 3 | 4 | namespace AggregateSource.EventStore.Framework.Snapshots 5 | { 6 | public static class AsyncSnapshotReaderFactory 7 | { 8 | public static AsyncSnapshotReader Create() 9 | { 10 | return Create(EmbeddedEventStore.Connection, SnapshotReaderConfigurationFactory.Create()); 11 | } 12 | 13 | public static AsyncSnapshotReader CreateWithConfiguration(SnapshotReaderConfiguration configuration) 14 | { 15 | return Create(EmbeddedEventStore.Connection, configuration); 16 | } 17 | 18 | public static AsyncSnapshotReader CreateWithConnection(IEventStoreConnection connection) 19 | { 20 | return Create(connection, SnapshotReaderConfigurationFactory.Create()); 21 | } 22 | 23 | public static AsyncSnapshotReader Create(IEventStoreConnection connection, 24 | SnapshotReaderConfiguration configuration) 25 | { 26 | return new AsyncSnapshotReader(connection, configuration); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Snapshots/SnapshotDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using AggregateSource.EventStore.Snapshots; 4 | using EventStore.ClientAPI; 5 | 6 | namespace AggregateSource.EventStore.Framework.Snapshots 7 | { 8 | public class SnapshotDeserializer : ISnapshotDeserializer 9 | { 10 | public Snapshot Deserialize(ResolvedEvent resolvedEvent) 11 | { 12 | var type = Type.GetType(resolvedEvent.Event.EventType, true); 13 | var instance = Activator.CreateInstance(type); 14 | using (var stream = new MemoryStream(resolvedEvent.Event.Data)) 15 | { 16 | using (var reader = new BinaryReader(stream)) 17 | { 18 | ((IBinaryDeserializer) instance).Read(reader); 19 | return new Snapshot(BitConverter.ToInt32(resolvedEvent.Event.Metadata, 0), instance); 20 | } 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Snapshots/SnapshotReaderConfigurationFactory.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Resolvers; 2 | using AggregateSource.EventStore.Snapshots; 3 | using EventStore.ClientAPI.SystemData; 4 | 5 | namespace AggregateSource.EventStore.Framework.Snapshots 6 | { 7 | public static class SnapshotReaderConfigurationFactory 8 | { 9 | public static SnapshotReaderConfiguration Create() 10 | { 11 | return new SnapshotReaderConfiguration(new SnapshotDeserializer(), new SnapshotStreamNameResolver(), 12 | new FixedStreamUserCredentialsResolver(new UserCredentials("admin", 13 | "changeit"))); 14 | } 15 | 16 | public static SnapshotReaderConfiguration CreateWithResolver(IStreamNameResolver resolver) 17 | { 18 | return new SnapshotReaderConfiguration(new SnapshotDeserializer(), resolver, 19 | new FixedStreamUserCredentialsResolver(new UserCredentials("admin", 20 | "changeit"))); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Snapshots/SnapshotReaderFactory.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Snapshots; 2 | using EventStore.ClientAPI; 3 | 4 | namespace AggregateSource.EventStore.Framework.Snapshots 5 | { 6 | public static class SnapshotReaderFactory 7 | { 8 | public static SnapshotReader Create() 9 | { 10 | return Create(EmbeddedEventStore.Connection, SnapshotReaderConfigurationFactory.Create()); 11 | } 12 | 13 | public static SnapshotReader CreateWithConfiguration(SnapshotReaderConfiguration configuration) 14 | { 15 | return Create(EmbeddedEventStore.Connection, configuration); 16 | } 17 | 18 | public static SnapshotReader CreateWithConnection(IEventStoreConnection connection) 19 | { 20 | return Create(connection, SnapshotReaderConfigurationFactory.Create()); 21 | } 22 | 23 | public static SnapshotReader Create(IEventStoreConnection connection, SnapshotReaderConfiguration configuration) 24 | { 25 | return new SnapshotReader(connection, configuration); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Snapshots/SnapshotStateStub.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace AggregateSource.EventStore.Framework.Snapshots 4 | { 5 | public class SnapshotStateStub : IBinarySerializer, IBinaryDeserializer 6 | { 7 | int _value; 8 | 9 | public SnapshotStateStub() {} 10 | 11 | public SnapshotStateStub(int value) 12 | { 13 | _value = value; 14 | } 15 | 16 | public void Write(BinaryWriter writer) 17 | { 18 | writer.Write(_value); 19 | } 20 | 21 | public void Read(BinaryReader reader) 22 | { 23 | _value = reader.ReadInt32(); 24 | } 25 | 26 | public override bool Equals(object obj) 27 | { 28 | return Equals(obj as SnapshotStateStub); 29 | } 30 | 31 | bool Equals(SnapshotStateStub other) 32 | { 33 | return !ReferenceEquals(other, null) && _value.Equals(other._value); 34 | } 35 | 36 | public override int GetHashCode() 37 | { 38 | unchecked 39 | { 40 | return _value.GetHashCode()*10 + 1; 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/Snapshots/SnapshotStreamNameResolver.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.EventStore.Framework.Snapshots 2 | { 3 | public class SnapshotStreamNameResolver : IStreamNameResolver 4 | { 5 | public string Resolve(string identifier) 6 | { 7 | return identifier + "-snapshot"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.EventStore 4 | { 5 | public class Model 6 | { 7 | public Model() 8 | { 9 | KnownIdentifier = "aggregate/" + Guid.NewGuid(); 10 | UnknownIdentifier = "aggregate/" + Guid.NewGuid(); 11 | } 12 | 13 | public string KnownIdentifier { get; private set; } 14 | public string UnknownIdentifier { get; private set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.EventStore.IntegratedTests")] 4 | [assembly: AssemblyDescription("AggregateSource integration with GetEventStore © Event Store LLP. Integration tests.")] -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Snapshots/Framework/SnapshotStoreReadConfigurationFactory.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Resolvers; 2 | using EventStore.ClientAPI.SystemData; 3 | 4 | namespace AggregateSource.EventStore.Snapshots.Framework { 5 | public static class SnapshotStoreReadConfigurationFactory { 6 | public static SnapshotStoreReadConfiguration Create() { 7 | return new SnapshotStoreReadConfiguration(new SnapshotDeserializer(), new SnapshotStreamNameResolver(), new FixedStreamUserCredentialsResolver(new UserCredentials("admin", "changeit"))); 8 | } 9 | 10 | public static SnapshotStoreReadConfiguration CreateWithResolver(IStreamNameResolver resolver) { 11 | return new SnapshotStoreReadConfiguration(new SnapshotDeserializer(), resolver, new FixedStreamUserCredentialsResolver(new UserCredentials("admin", "changeit"))); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/Snapshots/SnapshotableAggregateRootEntityStub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using AggregateSource.EventStore.Framework; 5 | using AggregateSource.EventStore.Framework.Snapshots; 6 | 7 | namespace AggregateSource.EventStore.Snapshots 8 | { 9 | public class SnapshotableAggregateRootEntityStub : AggregateRootEntity, ISnapshotable 10 | { 11 | public static readonly Func Factory = 12 | () => new SnapshotableAggregateRootEntityStub(); 13 | 14 | readonly List _recordedEvents; 15 | 16 | public SnapshotableAggregateRootEntityStub() 17 | { 18 | _recordedEvents = new List(); 19 | 20 | Register(_ => _recordedEvents.Add(_)); 21 | } 22 | 23 | public object RecordedSnapshot { get; private set; } 24 | 25 | public IList RecordedEvents 26 | { 27 | get { return new ReadOnlyCollection(_recordedEvents); } 28 | } 29 | 30 | public void RestoreSnapshot(object state) 31 | { 32 | RecordedSnapshot = state; 33 | } 34 | 35 | public object TakeSnapshot() 36 | { 37 | return new SnapshotStateStub(new Random().Next()); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.IntegratedTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Builders/SnapshotBuilder.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Snapshots; 2 | 3 | namespace AggregateSource.EventStore.Builders 4 | { 5 | public class SnapshotBuilder 6 | { 7 | readonly object _state; 8 | readonly int _version; 9 | 10 | public static readonly SnapshotBuilder Default = new SnapshotBuilder(); 11 | 12 | SnapshotBuilder() : this(0, new object()) {} 13 | 14 | SnapshotBuilder(int version, object state) 15 | { 16 | _state = state; 17 | _version = version; 18 | } 19 | 20 | public object State 21 | { 22 | get { return _state; } 23 | } 24 | 25 | public int Version 26 | { 27 | get { return _version; } 28 | } 29 | 30 | public SnapshotBuilder WithState(object value) 31 | { 32 | return new SnapshotBuilder(_version, value); 33 | } 34 | 35 | public SnapshotBuilder WithVersion(int value) 36 | { 37 | return new SnapshotBuilder(value, _state); 38 | } 39 | 40 | public Snapshot Build() 41 | { 42 | return new Snapshot(_version, _state); 43 | } 44 | 45 | public static implicit operator Snapshot(SnapshotBuilder builder) 46 | { 47 | return builder.Build(); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/EventReaderConfigurationTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using AggregateSource.EventStore.Builders; 3 | using AggregateSource.EventStore.Stubs; 4 | using NUnit.Framework; 5 | 6 | namespace AggregateSource.EventStore 7 | { 8 | [TestFixture] 9 | public class EventReaderConfigurationTests 10 | { 11 | EventReaderConfigurationBuilder _sutBuilder; 12 | 13 | [SetUp] 14 | public void SetUp() 15 | { 16 | _sutBuilder = EventReaderConfigurationBuilder.Default; 17 | } 18 | 19 | [Test] 20 | public void DeserializerCannotBeNull() 21 | { 22 | Assert.Throws(() => _sutBuilder.UsingDeserializer(null).Build()); 23 | } 24 | 25 | [Test] 26 | public void StreamNameResolverCannotBeNull() 27 | { 28 | Assert.Throws(() => _sutBuilder.UsingStreamNameResolver(null).Build()); 29 | } 30 | 31 | [Test] 32 | public void StreamUserCredentialsResolverCannotBeNull() 33 | { 34 | Assert.Throws(() => _sutBuilder.UsingStreamUserCredentialsResolver(null).Build()); 35 | } 36 | 37 | [Test] 38 | public void UsingConstructorReturnsInstanceWithExpectedProperties() 39 | { 40 | var sut = _sutBuilder.Build(); 41 | 42 | Assert.That(sut.SliceSize, Is.EqualTo(new SliceSize(1))); 43 | Assert.That(sut.Deserializer, Is.SameAs(StubbedEventDeserializer.Instance)); 44 | Assert.That(sut.StreamNameResolver, Is.SameAs(StubbedStreamNameResolver.Instance)); 45 | Assert.That(sut.StreamUserCredentialsResolver, Is.SameAs(StubbedStreamUserCredentialsResolver.Instance)); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.EventStore.Tests")] 4 | [assembly: AssemblyDescription("AggregateSource integration with GetEventStore © Event Store LLP. Unit tests.")] -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Resolvers/FixedStreamUserCredentialsResolverTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using EventStore.ClientAPI.SystemData; 3 | using NUnit.Framework; 4 | 5 | namespace AggregateSource.EventStore.Resolvers 6 | { 7 | [TestFixture] 8 | public class FixedStreamUserCredentialsResolverTests 9 | { 10 | FixedStreamUserCredentialsResolver _sut; 11 | UserCredentials _credentials; 12 | 13 | [SetUp] 14 | public void SetUp() 15 | { 16 | _credentials = new UserCredentials("admin", "changeit"); 17 | _sut = new FixedStreamUserCredentialsResolver(_credentials); 18 | } 19 | 20 | [Test] 21 | public void FixedUserCredentialsCanNotBeNull() 22 | { 23 | Assert.Throws(() => new FixedStreamUserCredentialsResolver(null)); 24 | } 25 | 26 | [Test] 27 | public void IsStreamUserCredentialsResolver() 28 | { 29 | Assert.That(_sut, Is.InstanceOf()); 30 | } 31 | 32 | [Test] 33 | public void ResolveIdentifierCanNotBeNull() 34 | { 35 | Assert.Throws(() => _sut.Resolve(null)); 36 | } 37 | 38 | [Test] 39 | public void ResolveReturnsExpectedResult() 40 | { 41 | var identifier = Guid.NewGuid().ToString(); 42 | 43 | var result = _sut.Resolve(identifier); 44 | 45 | Assert.That(result, Is.SameAs(_credentials)); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Resolvers/NoStreamUserCredentialsResolverTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace AggregateSource.EventStore.Resolvers 5 | { 6 | [TestFixture] 7 | public class NoStreamUserCredentialsResolverTests 8 | { 9 | NoStreamUserCredentialsResolver _sut; 10 | 11 | [SetUp] 12 | public void SetUp() 13 | { 14 | _sut = new NoStreamUserCredentialsResolver(); 15 | } 16 | 17 | [Test] 18 | public void IsStreamUserCredentialsResolver() 19 | { 20 | Assert.That(_sut, Is.InstanceOf()); 21 | } 22 | 23 | [Test] 24 | public void ResolveIdentifierCanNotBeNull() 25 | { 26 | Assert.Throws(() => _sut.Resolve(null)); 27 | } 28 | 29 | [Test] 30 | public void ResolveReturnsExpectedResult() 31 | { 32 | var identifier = Guid.NewGuid().ToString(); 33 | 34 | var result = _sut.Resolve(identifier); 35 | 36 | Assert.That(result, Is.Null); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Resolvers/PassThroughStreamNameResolverTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace AggregateSource.EventStore.Resolvers 5 | { 6 | [TestFixture] 7 | public class PassThroughStreamNameResolverTests 8 | { 9 | PassThroughStreamNameResolver _sut; 10 | 11 | [SetUp] 12 | public void SetUp() 13 | { 14 | _sut = new PassThroughStreamNameResolver(); 15 | } 16 | 17 | [Test] 18 | public void IsStreamNameResolver() 19 | { 20 | Assert.That(_sut, Is.InstanceOf()); 21 | } 22 | 23 | [Test] 24 | public void ResolveIdentifierCanNotBeNull() 25 | { 26 | Assert.Throws(() => _sut.Resolve(null)); 27 | } 28 | 29 | [Test] 30 | public void ResolveReturnsExpectedResult() 31 | { 32 | const string identifier = "Id/DE3094E3-B9E8-4AD0-98FF-4945C4ED4823"; 33 | var result = _sut.Resolve(identifier); 34 | Assert.That(result, Is.EqualTo(identifier)); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Snapshots/SnapshotReaderConfigurationTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using AggregateSource.EventStore.Builders; 3 | using AggregateSource.EventStore.Stubs; 4 | using NUnit.Framework; 5 | 6 | namespace AggregateSource.EventStore.Snapshots 7 | { 8 | [TestFixture] 9 | public class SnapshotReaderConfigurationTests 10 | { 11 | SnapshotReaderConfigurationBuilder _sutBuilder; 12 | 13 | [SetUp] 14 | public void SetUp() 15 | { 16 | _sutBuilder = SnapshotReaderConfigurationBuilder.Default; 17 | } 18 | 19 | [Test] 20 | public void DeserializerCannotBeNull() 21 | { 22 | Assert.Throws(() => _sutBuilder.UsingDeserializer(null).Build()); 23 | } 24 | 25 | [Test] 26 | public void StreamNameResolverCannotBeNull() 27 | { 28 | Assert.Throws(() => _sutBuilder.UsingStreamNameResolver(null).Build()); 29 | } 30 | 31 | [Test] 32 | public void StreamUserCredentialsResolverCannotBeNull() 33 | { 34 | Assert.Throws(() => _sutBuilder.UsingStreamUserCredentialsResolver(null).Build()); 35 | } 36 | 37 | [Test] 38 | public void UsingConstructorReturnsInstanceWithExpectedProperties() 39 | { 40 | var sut = _sutBuilder.Build(); 41 | 42 | Assert.That(sut.Deserializer, Is.SameAs(StubbedSnapshotDeserializer.Instance)); 43 | Assert.That(sut.StreamNameResolver, Is.SameAs(StubbedStreamNameResolver.Instance)); 44 | Assert.That(sut.StreamUserCredentialsResolver, Is.SameAs(StubbedStreamUserCredentialsResolver.Instance)); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Stubs/StubbedEventDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using EventStore.ClientAPI; 4 | 5 | namespace AggregateSource.EventStore.Stubs 6 | { 7 | public class StubbedEventDeserializer : IEventDeserializer 8 | { 9 | public static readonly IEventDeserializer Instance = new StubbedEventDeserializer(); 10 | 11 | StubbedEventDeserializer() {} 12 | 13 | public IEnumerable Deserialize(ResolvedEvent resolvedEvent) 14 | { 15 | return Enumerable.Empty(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Stubs/StubbedSnapshotDeserializer.cs: -------------------------------------------------------------------------------- 1 | using AggregateSource.EventStore.Snapshots; 2 | using EventStore.ClientAPI; 3 | 4 | namespace AggregateSource.EventStore.Stubs 5 | { 6 | public class StubbedSnapshotDeserializer : ISnapshotDeserializer 7 | { 8 | public static readonly ISnapshotDeserializer Instance = new StubbedSnapshotDeserializer(); 9 | 10 | StubbedSnapshotDeserializer() {} 11 | 12 | public Snapshot Deserialize(ResolvedEvent resolvedEvent) 13 | { 14 | return null; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Stubs/StubbedStreamNameResolver.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.EventStore.Stubs 2 | { 3 | public class StubbedStreamNameResolver : IStreamNameResolver 4 | { 5 | public static readonly IStreamNameResolver Instance = new StubbedStreamNameResolver(); 6 | 7 | StubbedStreamNameResolver() {} 8 | 9 | public string Resolve(string identifier) 10 | { 11 | return null; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/Stubs/StubbedStreamUserCredentialsResolver.cs: -------------------------------------------------------------------------------- 1 | using EventStore.ClientAPI.SystemData; 2 | 3 | namespace AggregateSource.EventStore.Stubs 4 | { 5 | public class StubbedStreamUserCredentialsResolver : IStreamUserCredentialsResolver 6 | { 7 | public static readonly IStreamUserCredentialsResolver Instance = new StubbedStreamUserCredentialsResolver(); 8 | 9 | StubbedStreamUserCredentialsResolver() {} 10 | 11 | public UserCredentials Resolve(string identifier) 12 | { 13 | return new UserCredentials("", ""); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True 3 | True 4 | True 5 | None 6 | NEXT_LINE 7 | NEXT_LINE 8 | NEXT_LINE -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/IEventDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using EventStore.ClientAPI; 3 | 4 | namespace AggregateSource.EventStore 5 | { 6 | /// 7 | /// Represent an event deserializer. 8 | /// 9 | public interface IEventDeserializer 10 | { 11 | /// 12 | /// Deserializes a resolved event into zero, one or more events consumable by the aggregate root entity. 13 | /// 14 | /// The resolved event to deserialize. 15 | /// An enumeration of deserialized events. 16 | IEnumerable Deserialize(ResolvedEvent resolvedEvent); 17 | } 18 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/IStreamNameResolver.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.EventStore 2 | { 3 | /// 4 | /// Provides a way to resolve an identifier into a stream's name. 5 | /// 6 | public interface IStreamNameResolver 7 | { 8 | /// 9 | /// Resolves the specified into a stream name. 10 | /// 11 | /// The identifier to resolve. 12 | /// The resolved stream name. 13 | string Resolve(string identifier); 14 | } 15 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/IStreamUserCredentialsResolver.cs: -------------------------------------------------------------------------------- 1 | using EventStore.ClientAPI.SystemData; 2 | 3 | namespace AggregateSource.EventStore 4 | { 5 | /// 6 | /// Provides a way to resolve an identifier into the user credentials used to access the associated stream. 7 | /// 8 | public interface IStreamUserCredentialsResolver 9 | { 10 | /// 11 | /// Resolves the specified into user credentials used to access the associated stream. 12 | /// 13 | /// The identifier. 14 | /// The associated . 15 | UserCredentials Resolve(string identifier); 16 | } 17 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("AggregateSource.EventStore")] 5 | [assembly: AssemblyDescription("AggregateSource integration with GetEventStore © Event Store LLP.")] -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Resolvers/FixedStreamUserCredentialsResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using EventStore.ClientAPI.SystemData; 3 | 4 | namespace AggregateSource.EventStore.Resolvers 5 | { 6 | /// 7 | /// Stream user credentials resolver that can be used when all streams are accessed using the same user credentials. 8 | /// 9 | public class FixedStreamUserCredentialsResolver : IStreamUserCredentialsResolver 10 | { 11 | readonly UserCredentials _fixedUserCredentials; 12 | 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | /// The fixed user credentials. 17 | /// Thrown when the is null. 18 | public FixedStreamUserCredentialsResolver(UserCredentials fixedUserCredentials) 19 | { 20 | if (fixedUserCredentials == null) throw new ArgumentNullException("fixedUserCredentials"); 21 | _fixedUserCredentials = fixedUserCredentials; 22 | } 23 | 24 | /// 25 | /// Resolves the specified into user credentials used to access the associated stream. 26 | /// 27 | /// The identifier. 28 | /// 29 | /// The associated . 30 | /// 31 | public UserCredentials Resolve(string identifier) 32 | { 33 | if (identifier == null) throw new ArgumentNullException("identifier"); 34 | return _fixedUserCredentials; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Resolvers/NoStreamUserCredentialsResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using EventStore.ClientAPI.SystemData; 3 | 4 | namespace AggregateSource.EventStore.Resolvers 5 | { 6 | /// 7 | /// Stream user credentials resolver that can be used when all streams are accessed without credentials. 8 | /// 9 | public class NoStreamUserCredentialsResolver : IStreamUserCredentialsResolver 10 | { 11 | /// 12 | /// Resolves the specified into user credentials used to access the associated stream. 13 | /// 14 | /// The identifier. 15 | /// 16 | /// The associated . 17 | /// 18 | /// identifier 19 | public UserCredentials Resolve(string identifier) 20 | { 21 | if (identifier == null) throw new ArgumentNullException("identifier"); 22 | return null; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Resolvers/PassThroughStreamNameResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.EventStore.Resolvers 4 | { 5 | /// 6 | /// Stream name resolver that can be used when the identifier is the stream name. 7 | /// 8 | public class PassThroughStreamNameResolver : IStreamNameResolver 9 | { 10 | /// 11 | /// Resolves the specified into a stream name. 12 | /// 13 | /// The identifier to resolve. 14 | /// 15 | /// The resolved stream name. 16 | /// 17 | /// Thrown when the is null. 18 | public string Resolve(string identifier) 19 | { 20 | if (identifier == null) throw new ArgumentNullException("identifier"); 21 | return identifier; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/SliceSize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using AggregateSource.EventStore.Properties; 3 | 4 | namespace AggregateSource.EventStore 5 | { 6 | /// 7 | /// Represent the size of a slice to read from the event store. 8 | /// 9 | public struct SliceSize 10 | { 11 | readonly int _value; 12 | 13 | /// 14 | /// Initializes a new instance of the struct. 15 | /// 16 | /// The size of the slice to read from the event store. 17 | /// Throw when the value is less than 1. 18 | public SliceSize(int value) 19 | { 20 | if (value < 1) 21 | throw new ArgumentOutOfRangeException("value", Resources.SliceSize_GreaterThanOne); 22 | _value = value; 23 | } 24 | 25 | /// 26 | /// Converts the specified size to an integer. 27 | /// 28 | /// The slice size. 29 | /// The value of the slice to read. 30 | public static implicit operator Int32(SliceSize size) 31 | { 32 | return size._value; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Snapshots/IAsyncSnapshotReader.cs: -------------------------------------------------------------------------------- 1 | #if !NET40 2 | using System.Threading.Tasks; 3 | 4 | namespace AggregateSource.EventStore.Snapshots 5 | { 6 | /// 7 | /// Represents the async behavior that reads a from the underlying storage. 8 | /// 9 | public interface IAsyncSnapshotReader 10 | { 11 | /// 12 | /// Reads a snapshot from the underlying storage if one is present. 13 | /// 14 | /// The aggregate identifier. 15 | /// A if found, otherwise empty. 16 | Task> ReadOptionalAsync(string identifier); 17 | } 18 | } 19 | #endif -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Snapshots/ISnapshotDeserializer.cs: -------------------------------------------------------------------------------- 1 | using EventStore.ClientAPI; 2 | 3 | namespace AggregateSource.EventStore.Snapshots 4 | { 5 | /// 6 | /// Represents a snapshot deserializer. 7 | /// 8 | public interface ISnapshotDeserializer 9 | { 10 | /// 11 | /// Deserializes a resolved event into an snapshot consumable by the aggregate root entity. 12 | /// 13 | /// The resolved event to deserialize. 14 | /// The deserialized snapshot. 15 | Snapshot Deserialize(ResolvedEvent resolvedEvent); 16 | } 17 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/Snapshots/ISnapshotReader.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.EventStore.Snapshots 2 | { 3 | /// 4 | /// Represents the behavior that reads a from the underlying storage. 5 | /// 6 | public interface ISnapshotReader 7 | { 8 | /// 9 | /// Reads a snapshot from the underlying storage if one is present. 10 | /// 11 | /// The aggregate identifier. 12 | /// A if found, otherwise empty. 13 | Optional ReadOptional(string identifier); 14 | } 15 | } -------------------------------------------------------------------------------- /src/EventStore/AggregateSource.EventStore/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/NEventStore/.nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Framework/AggregateRootEntityStub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace AggregateSource.NEventStore.Framework 6 | { 7 | public class AggregateRootEntityStub : AggregateRootEntity 8 | { 9 | public static readonly Func Factory = () => new AggregateRootEntityStub(); 10 | 11 | readonly List _recordedEvents; 12 | 13 | public AggregateRootEntityStub() 14 | { 15 | _recordedEvents = new List(); 16 | 17 | Register(_ => _recordedEvents.Add(_)); 18 | } 19 | 20 | public IList RecordedEvents 21 | { 22 | get { return new ReadOnlyCollection(_recordedEvents); } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Framework/Catch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.NEventStore.Framework 4 | { 5 | public static class Catch 6 | { 7 | public static void ExceptionOf(Action action) 8 | { 9 | // ReSharper disable EmptyGeneralCatchClause 10 | try 11 | { 12 | action(); 13 | } 14 | catch {} 15 | // ReSharper restore EmptyGeneralCatchClause 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Framework/EventStub.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.NEventStore.Framework 2 | { 3 | public class EventStub 4 | { 5 | public int Value { get; private set; } 6 | 7 | public EventStub() {} 8 | 9 | public EventStub(int value) 10 | { 11 | Value = value; 12 | } 13 | 14 | public override bool Equals(object obj) 15 | { 16 | return Equals(obj as EventStub); 17 | } 18 | 19 | bool Equals(EventStub @event) 20 | { 21 | return !ReferenceEquals(@event, null) && Value.Equals(@event.Value); 22 | } 23 | 24 | public override int GetHashCode() 25 | { 26 | unchecked 27 | { 28 | return Value.GetHashCode()*10 + 2; 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Framework/Snapshots/SnapshotStateStub.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.NEventStore.Framework.Snapshots 2 | { 3 | public class SnapshotStateStub 4 | { 5 | public int Value { get; private set; } 6 | 7 | public SnapshotStateStub() {} 8 | 9 | public SnapshotStateStub(int value) 10 | { 11 | Value = value; 12 | } 13 | 14 | public override bool Equals(object obj) 15 | { 16 | return Equals(obj as SnapshotStateStub); 17 | } 18 | 19 | bool Equals(SnapshotStateStub other) 20 | { 21 | return !ReferenceEquals(other, null) && Value.Equals(other.Value); 22 | } 23 | 24 | public override int GetHashCode() 25 | { 26 | unchecked 27 | { 28 | return Value.GetHashCode()*10 + 1; 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Framework/Snapshots/SnapshotableAggregateRootEntityStub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace AggregateSource.NEventStore.Framework.Snapshots 6 | { 7 | public class SnapshotableAggregateRootEntityStub : AggregateRootEntity, ISnapshotable 8 | { 9 | public static readonly Func Factory = 10 | () => new SnapshotableAggregateRootEntityStub(); 11 | 12 | readonly List _recordedEvents; 13 | 14 | public SnapshotableAggregateRootEntityStub() 15 | { 16 | _recordedEvents = new List(); 17 | 18 | Register(_ => _recordedEvents.Add(_)); 19 | } 20 | 21 | public object RecordedSnapshot { get; private set; } 22 | 23 | public IList RecordedEvents 24 | { 25 | get { return new ReadOnlyCollection(_recordedEvents); } 26 | } 27 | 28 | public void RestoreSnapshot(object state) 29 | { 30 | RecordedSnapshot = state; 31 | } 32 | 33 | public object TakeSnapshot() 34 | { 35 | return new SnapshotStateStub(new Random().Next()); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.NEventStore 4 | { 5 | public class Model 6 | { 7 | public Model() 8 | { 9 | KnownIdentifier = "aggregate/" + Guid.NewGuid(); 10 | UnknownIdentifier = "aggregate/" + Guid.NewGuid(); 11 | } 12 | 13 | public string KnownIdentifier { get; private set; } 14 | public string UnknownIdentifier { get; private set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.EventStore.Tests")] 4 | [assembly: AssemblyDescription("AggregateSource integration with NEventStore. Unit tests.")] -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | False 3 | False 4 | True 5 | True 6 | True -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.NEventStore")] 4 | [assembly: AssemblyDescription("AggregateSource integration with NEventStore.")] -------------------------------------------------------------------------------- /src/NEventStore/AggregateSource.NEventStore/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Reactive/AggregateSource.Reactive.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("AggregateSource.Tests")] 5 | [assembly: 6 | AssemblyDescription( 7 | "AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model. Unit tests." 8 | )] -------------------------------------------------------------------------------- /src/Reactive/AggregateSource.Reactive.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Reactive/AggregateSource.Reactive.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | False -------------------------------------------------------------------------------- /src/Reactive/AggregateSource.Reactive/IObservableAggregateRootEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Reactive 4 | { 5 | /// 6 | /// Observable aggregate root entity marker interface. 7 | /// 8 | public interface IObservableAggregateRootEntity : IAggregateRootEntity, IObservable, IDisposable {} 9 | } -------------------------------------------------------------------------------- /src/Reactive/AggregateSource.Reactive/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.Reactive")] 4 | [assembly: AssemblyDescription("AggregateSource's reactive library for building an eventsourced, aggregate based domain model.")] -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventStoreShopping", "EventStoreShopping\EventStoreShopping.csproj", "{DC079412-586D-4F8B-AB88-B123A0E0EA2D}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {DC079412-586D-4F8B-AB88-B123A0E0EA2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {DC079412-586D-4F8B-AB88-B123A0E0EA2D}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {DC079412-586D-4F8B-AB88-B123A0E0EA2D}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {DC079412-586D-4F8B-AB88-B123A0E0EA2D}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Commands/AddItemToCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Commands 2 | { 3 | public class AddItemToCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | public int Count { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Commands/Checkout.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Commands 2 | { 3 | public class CheckoutCart 4 | { 5 | public string CartId { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Commands/DecrementItemInCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Commands 2 | { 3 | public class DecrementItemCountInCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | public int NumberOfItems { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Commands/IncrementItemInCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Commands 2 | { 3 | public class IncrementItemCountInCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Commands/RemoveItemFromCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Commands 2 | { 3 | public class RemoveItemFromCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Commands/StartShopping.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Commands 2 | { 3 | public class StartShopping 4 | { 5 | public string CartId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Events/AddedItemToCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Events 2 | { 3 | public class AddedItemToCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | public int Count { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Events/CheckedoutCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Events 2 | { 3 | public class CheckedoutCart 4 | { 5 | public string CartId { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Events/DecrementedItemCountInCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Events 2 | { 3 | public class DecrementedItemCountInCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Events/IncrementedItemCountInCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Events 2 | { 3 | public class IncrementedItemCountInCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Events/RemovedItemFromCart.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Events 2 | { 3 | public class RemovedItemFromCart 4 | { 5 | public string CartId { get; set; } 6 | public string ItemId { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Messaging/Events/StartedShopping.cs: -------------------------------------------------------------------------------- 1 | namespace EventStoreShopping.Messaging.Events 2 | { 3 | public class StartedShopping 4 | { 5 | public string CartId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("EventStoreShopping")] 5 | [assembly: AssemblyDescription("")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("BitTacklr")] 8 | [assembly: AssemblyProduct("EventStoreShopping")] 9 | [assembly: AssemblyCopyright("Copyright © BitTacklr 2014")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | [assembly: ComVisible(false)] 13 | [assembly: AssemblyVersion("0.0.0.0")] 14 | [assembly: AssemblyFileVersion("0.0.0.0")] 15 | -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Shopping/ItemId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EventStoreShopping.Shopping 4 | { 5 | public struct ItemId : IEquatable 6 | { 7 | private readonly string _value; 8 | 9 | public ItemId(string value) 10 | { 11 | if (value == null) throw new ArgumentNullException("value"); 12 | _value = value; 13 | } 14 | 15 | public bool Equals(ItemId other) 16 | { 17 | return string.Equals(_value, other._value); 18 | } 19 | 20 | public override bool Equals(object obj) 21 | { 22 | if (ReferenceEquals(null, obj)) return false; 23 | return obj is ItemId && Equals((ItemId)obj); 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return _value.GetHashCode(); 29 | } 30 | 31 | public static bool operator ==(ItemId left, ItemId right) 32 | { 33 | return left.Equals(right); 34 | } 35 | 36 | public static bool operator !=(ItemId left, ItemId right) 37 | { 38 | return !left.Equals(right); 39 | } 40 | 41 | public static implicit operator string(ItemId id) 42 | { 43 | return id._value; 44 | } 45 | 46 | public override string ToString() 47 | { 48 | return "Item/" + _value; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Shopping/ShoppingCartAlreadyCheckedOutException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EventStoreShopping.Shopping 4 | { 5 | public class ShoppingCartAlreadyCheckedOutException : Exception 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Shopping/ShoppingCartDoesNotContainItemException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EventStoreShopping.Shopping 4 | { 5 | public class ShoppingCartDoesNotContainItemException : Exception 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/Shopping/ShoppingCartId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EventStoreShopping.Shopping 4 | { 5 | public struct ShoppingCartId : IEquatable 6 | { 7 | private readonly string _value; 8 | 9 | public ShoppingCartId(string value) 10 | { 11 | if (value == null) throw new ArgumentNullException("value"); 12 | _value = value; 13 | } 14 | 15 | public bool Equals(ShoppingCartId other) 16 | { 17 | return string.Equals(_value, other._value); 18 | } 19 | 20 | public override bool Equals(object obj) 21 | { 22 | if (ReferenceEquals(null, obj)) return false; 23 | return obj is ShoppingCartId && Equals((ShoppingCartId)obj); 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return _value.GetHashCode(); 29 | } 30 | 31 | public static bool operator ==(ShoppingCartId left, ShoppingCartId right) 32 | { 33 | return left.Equals(right); 34 | } 35 | 36 | public static bool operator !=(ShoppingCartId left, ShoppingCartId right) 37 | { 38 | return !left.Equals(right); 39 | } 40 | 41 | public static implicit operator string(ShoppingCartId id) 42 | { 43 | return id._value; 44 | } 45 | 46 | public override string ToString() 47 | { 48 | return "ShoppingCart/" + _value; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/Recipes/EventStoreShopping/EventStoreShopping/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/SampleSource/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SampleSource")] 6 | [assembly: AssemblyDescription("Samples illustrating the use of AggregateSource.")] -------------------------------------------------------------------------------- /src/SampleSource/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/SharedAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Deze code is gegenereerd met een hulpprogramma. 4 | // Runtime-versie:4.0.30319.42000 5 | // 6 | // Als u wijzigingen aanbrengt in dit bestand, kan dit onjuist gedrag veroorzaken wanneer 7 | // de code wordt gegenereerd. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | [assembly: System.Reflection.AssemblyConfiguration("Release")] 12 | [assembly: System.Reflection.AssemblyCompany("BitTacklr")] 13 | [assembly: System.Reflection.AssemblyCopyright("Copyright 2016, BitTacklr. All rights reserved.")] 14 | [assembly: System.Reflection.AssemblyProduct("AggregateSource")] 15 | [assembly: System.Reflection.AssemblyTrademark("AggregateSource is a trademark of BitTacklr")] 16 | [assembly: System.Runtime.InteropServices.ComVisible(false)] 17 | [assembly: System.CLSCompliant(false)] 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/SharedVersionInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Deze code is gegenereerd met een hulpprogramma. 4 | // Runtime-versie:4.0.30319.42000 5 | // 6 | // Als u wijzigingen aanbrengt in dit bestand, kan dit onjuist gedrag veroorzaken wanneer 7 | // de code wordt gegenereerd. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | [assembly: System.Reflection.AssemblyVersion("0.0.308.0")] 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.NUnit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.Testing.NUnit")] 4 | [assembly: AssemblyDescription("AggregateSource's fluent test specification builder library - NUnit integration.")] -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.NUnit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/AggregateRootEntityStub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | public class AggregateRootEntityStub : AggregateRootEntity 6 | { 7 | public static readonly Func Factory = () => new AggregateRootEntityStub(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/Model.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | public static class Model 6 | { 7 | public static readonly string Identifier1 = "Aggregate/" + Guid.NewGuid(); 8 | public static readonly string Identifier2 = "Aggregate/" + Guid.NewGuid(); 9 | } 10 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.Testing.Tests")] 4 | [assembly: AssemblyDescription("AggregateSource's fluent test specification builder library. Unit tests.")] -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/ScenarioTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | namespace ScenarioTests 6 | { 7 | [TestFixture] 8 | public class ScenarioTests 9 | { 10 | [Test] 11 | public void IsScenarioInitialStateBuilder() 12 | { 13 | Assert.That(new Scenario(), Is.InstanceOf()); 14 | } 15 | } 16 | 17 | [TestFixture] 18 | public class ScenarioGivenNoneTests : GivenNoneFixture 19 | { 20 | protected override IScenarioGivenNoneStateBuilder GivenNone() 21 | { 22 | return new Scenario().GivenNone(); 23 | } 24 | } 25 | 26 | public abstract class GivenNoneFixture 27 | { 28 | protected abstract IScenarioGivenNoneStateBuilder GivenNone(); 29 | 30 | [Test] 31 | public void GivenNoneDoesNotReturnNull() 32 | { 33 | var result = GivenNone(); 34 | Assert.That(result, Is.Not.Null); 35 | } 36 | 37 | [Test] 38 | public void GivenNoneReturnsGivenNoneBuilderContinuation() 39 | { 40 | var result = GivenNone(); 41 | Assert.That(result, Is.InstanceOf()); 42 | } 43 | 44 | [Test] 45 | [Repeat(2)] 46 | public void GivenNoneReturnsNewInstanceUponEachCall() 47 | { 48 | Assert.That( 49 | GivenNone(), 50 | Is.Not.SameAs(GivenNone())); 51 | } 52 | 53 | 54 | [Test] 55 | public void IsSetInResultingSpecification() 56 | { 57 | var result = GivenNone().When(new object()).Build().Givens; 58 | 59 | Assert.That(result, Is.EquivalentTo(Fact.Empty)); 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/ScenarioThrowStateBuilderTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace AggregateSource.Testing 5 | { 6 | namespace ScenarioThrowStateBuilderTests 7 | { 8 | [TestFixture] 9 | public class WhenStateBuilderThrowTests : ThrowFixture 10 | { 11 | protected override IScenarioThrowStateBuilder Throw(Exception exception) 12 | { 13 | return new Scenario().Given("", new object[0]).When(new object()).Throws(exception); 14 | } 15 | } 16 | 17 | public abstract class ThrowFixture 18 | { 19 | protected abstract IScenarioThrowStateBuilder Throw(Exception exception); 20 | 21 | [Test] 22 | public void ThrowThrowsWhenExceptionIsNull() 23 | { 24 | Assert.Throws(() => Throw(null)); 25 | } 26 | 27 | [Test] 28 | public void ThrowDoesNotReturnNull() 29 | { 30 | var result = Throw(new Exception()); 31 | Assert.That(result, Is.Not.Null); 32 | } 33 | 34 | [Test] 35 | public void ThrowReturnsThrowBuilderContinuation() 36 | { 37 | var result = Throw(new Exception()); 38 | Assert.That(result, Is.InstanceOf()); 39 | } 40 | 41 | [Test] 42 | [Repeat(2)] 43 | public void ThrowReturnsNewInstanceUponEachCall() 44 | { 45 | Assert.That( 46 | Throw(new Exception()), 47 | Is.Not.SameAs(Throw(new Exception()))); 48 | } 49 | 50 | [Test] 51 | public void IsSetInResultingSpecification() 52 | { 53 | var exception = new Exception(); 54 | 55 | var result = Throw(exception).Build().Throws; 56 | 57 | Assert.That(result, Is.SameAs(exception)); 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/TestSpecificationDataPointFixture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace AggregateSource.Testing 5 | { 6 | public abstract class TestSpecificationDataPointFixture 7 | { 8 | [Datapoint] 9 | public static Fact[] NoEvents = new Fact[0]; 10 | 11 | [Datapoint] 12 | public static Fact[] OneEvent = new[] { new Fact("Aggregate/" + Guid.NewGuid(), new object()) }; 13 | 14 | [Datapoint] 15 | public static Fact[] TwoEventsOfDifferentSources = new[] 16 | { 17 | new Fact("Aggregate/" + Guid.NewGuid(), new object()), 18 | new Fact("Aggregate/" + Guid.NewGuid(), new object()) 19 | }; 20 | 21 | [Datapoint] 22 | public static Fact[] TwoEventsOfTheSameSource = new[] 23 | { 24 | new Fact("Aggregate/" + new Guid("C8F75337-62BA-41F0-B57B-10171388FD6F"), new object()), 25 | new Fact("Aggregate/" + new Guid("C8F75337-62BA-41F0-B57B-10171388FD6F"), new object()) 26 | }; 27 | 28 | [Datapoint] public static object Message = new object(); 29 | 30 | [Datapoint] public static Exception Exception = new Exception("Message"); 31 | } 32 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Xunit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.Testing.Xunit")] 4 | [assembly: AssemblyDescription("AggregateSource's fluent test specification builder library - Xunit integration.")] -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.Xunit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | False -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Catch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | static class Catch 6 | { 7 | public static Optional Exception(Action action) 8 | { 9 | var result = Optional.Empty; 10 | try 11 | { 12 | action(); 13 | } 14 | catch (Exception exception) 15 | { 16 | result = new Optional(exception); 17 | } 18 | return result; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Command/AggregateCommandGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Command 4 | { 5 | class AggregateCommandGivenNoneStateBuilder : IAggregateCommandGivenNoneStateBuilder 6 | where TAggregateRoot : IAggregateRootEntity 7 | { 8 | readonly Func _sutFactory; 9 | 10 | public AggregateCommandGivenNoneStateBuilder(Func sutFactory) 11 | { 12 | _sutFactory = sutFactory; 13 | } 14 | 15 | public IAggregateCommandWhenStateBuilder When(Action command) 16 | { 17 | if (command == null) throw new ArgumentNullException("command"); 18 | return new AggregateCommandWhenStateBuilder(_sutFactory, new object[0], root => command((TAggregateRoot)root)); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Command/AggregateCommandGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET20 3 | using System.Collections.Generic; 4 | #endif 5 | #if !NET20 6 | using System.Linq; 7 | #endif 8 | 9 | namespace AggregateSource.Testing.Command 10 | { 11 | class AggregateCommandGivenStateBuilder : IAggregateCommandGivenStateBuilder 12 | where TAggregateRoot : IAggregateRootEntity 13 | { 14 | readonly Func _sutFactory; 15 | readonly object[] _givens; 16 | 17 | public AggregateCommandGivenStateBuilder(Func sutFactory, object[] givens) 18 | { 19 | _sutFactory = sutFactory; 20 | _givens = givens; 21 | } 22 | 23 | public IAggregateCommandGivenStateBuilder Given(params object[] events) 24 | { 25 | if (events == null) throw new ArgumentNullException("events"); 26 | #if NET20 27 | var givens = new List(); 28 | givens.AddRange(_givens); 29 | givens.AddRange(events); 30 | return new AggregateCommandGivenStateBuilder(_sutFactory, givens.ToArray()); 31 | #else 32 | return new AggregateCommandGivenStateBuilder(_sutFactory, _givens.Concat(events).ToArray()); 33 | #endif 34 | } 35 | 36 | public IAggregateCommandWhenStateBuilder When(Action command) 37 | { 38 | if (command == null) throw new ArgumentNullException("command"); 39 | return new AggregateCommandWhenStateBuilder(_sutFactory, _givens, root => command((TAggregateRoot) root)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Command/AggregateCommandThenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Command 4 | { 5 | class AggregateCommandThenNoneStateBuilder : IAggregateCommandThenNoneStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Action _when; 10 | 11 | public AggregateCommandThenNoneStateBuilder(Func sutFactory, object[] givens, Action when) 12 | { 13 | _sutFactory = sutFactory; 14 | _givens = givens; 15 | _when = when; 16 | } 17 | 18 | public EventCentricAggregateCommandTestSpecification Build() 19 | { 20 | return new EventCentricAggregateCommandTestSpecification(_sutFactory, _givens, _when, new object[0]); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Command/AggregateCommandThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET20 3 | using System.Collections.Generic; 4 | #endif 5 | #if !NET20 6 | using System.Linq; 7 | #endif 8 | 9 | namespace AggregateSource.Testing.Command 10 | { 11 | class AggregateCommandThenStateBuilder : IAggregateCommandThenStateBuilder 12 | { 13 | readonly Func _sutFactory; 14 | readonly object[] _givens; 15 | readonly Action _when; 16 | readonly object[] _thens; 17 | 18 | public AggregateCommandThenStateBuilder(Func sutFactory, object[] givens, 19 | Action when, object[] thens) 20 | { 21 | _sutFactory = sutFactory; 22 | _givens = givens; 23 | _when = when; 24 | _thens = thens; 25 | } 26 | 27 | public IAggregateCommandThenStateBuilder Then(params object[] events) 28 | { 29 | if (events == null) throw new ArgumentNullException("events"); 30 | #if NET20 31 | var thens = new List(); 32 | thens.AddRange(_thens); 33 | thens.AddRange(events); 34 | return new AggregateCommandThenStateBuilder(_sutFactory, _givens, _when, thens.ToArray()); 35 | #else 36 | return new AggregateCommandThenStateBuilder(_sutFactory, _givens, _when, _thens.Concat(events).ToArray()); 37 | #endif 38 | } 39 | 40 | public EventCentricAggregateCommandTestSpecification Build() 41 | { 42 | return new EventCentricAggregateCommandTestSpecification(_sutFactory, _givens, _when, _thens); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Command/AggregateCommandThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Command 4 | { 5 | class AggregateCommandThrowStateBuilder : IAggregateCommandThrowStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Action _when; 10 | readonly Exception _throws; 11 | 12 | public AggregateCommandThrowStateBuilder(Func sutFactory, object[] givens, 13 | Action when, Exception throws) 14 | { 15 | _sutFactory = sutFactory; 16 | _givens = givens; 17 | _when = when; 18 | _throws = throws; 19 | } 20 | 21 | public ExceptionCentricAggregateCommandTestSpecification Build() 22 | { 23 | return new ExceptionCentricAggregateCommandTestSpecification(_sutFactory, _givens, _when, _throws); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Command/AggregateCommandWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Command 4 | { 5 | class AggregateCommandWhenStateBuilder : IAggregateCommandWhenStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Action _when; 10 | 11 | public AggregateCommandWhenStateBuilder(Func sutFactory, object[] givens, 12 | Action when) 13 | { 14 | _sutFactory = sutFactory; 15 | _givens = givens; 16 | _when = when; 17 | } 18 | 19 | public IAggregateCommandThenNoneStateBuilder ThenNone() 20 | { 21 | return new AggregateCommandThenNoneStateBuilder(_sutFactory, _givens, _when); 22 | } 23 | 24 | public IAggregateCommandThenStateBuilder Then(params object[] events) 25 | { 26 | if (events == null) throw new ArgumentNullException("events"); 27 | return new AggregateCommandThenStateBuilder(_sutFactory, _givens, _when, events); 28 | } 29 | 30 | public IAggregateCommandThrowStateBuilder Throws(Exception exception) 31 | { 32 | if (exception == null) throw new ArgumentNullException("exception"); 33 | return new AggregateCommandThrowStateBuilder(_sutFactory, _givens, _when, exception); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Comparers/CompareNetObjectsBasedEventComparer.cs: -------------------------------------------------------------------------------- 1 | #if !NET20 2 | using System; 3 | using System.Collections.Generic; 4 | using KellermanSoftware.CompareNetObjects; 5 | 6 | namespace AggregateSource.Testing.Comparers 7 | { 8 | /// 9 | /// Compares events using a object and reports the differences. 10 | /// 11 | public class CompareNetObjectsBasedEventComparer : IEventComparer 12 | { 13 | private readonly ICompareLogic _logic; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The compare logic. 19 | /// Thrown when the is null. 20 | public CompareNetObjectsBasedEventComparer(ICompareLogic logic) 21 | { 22 | if (logic == null) throw new ArgumentNullException("logic"); 23 | _logic = logic; 24 | } 25 | 26 | /// 27 | /// Compares the expected to the actual event. 28 | /// 29 | /// The expected event. 30 | /// The actual event. 31 | /// 32 | /// An enumeration of differences, or empty if none found. 33 | /// 34 | public IEnumerable Compare(object expected, object actual) 35 | { 36 | var result = _logic.Compare(expected, actual); 37 | if (!result.AreEqual) 38 | { 39 | foreach (var difference in result.Differences) 40 | { 41 | yield return new EventComparisonDifference( 42 | expected, 43 | actual, 44 | difference.ToString()); 45 | } 46 | } 47 | } 48 | } 49 | } 50 | #endif -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Comparers/CompareNetObjectsBasedResultComparer.cs: -------------------------------------------------------------------------------- 1 | #if !NET20 2 | using System; 3 | using System.Collections.Generic; 4 | using KellermanSoftware.CompareNetObjects; 5 | 6 | namespace AggregateSource.Testing.Comparers 7 | { 8 | /// 9 | /// Compares results using a object and reports the differences. 10 | /// 11 | public class CompareNetObjectsBasedResultComparer : IResultComparer 12 | { 13 | private readonly ICompareLogic _logic; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// The comparer. 19 | /// Thrown when the is null. 20 | public CompareNetObjectsBasedResultComparer(ICompareLogic logic) 21 | { 22 | if (logic == null) throw new ArgumentNullException("logic"); 23 | _logic = logic; 24 | } 25 | 26 | /// 27 | /// Compares the expected to the actual event. 28 | /// 29 | /// The expected event. 30 | /// The actual event. 31 | /// 32 | /// An enumeration of differences, or empty if none found. 33 | /// 34 | public IEnumerable Compare(object expected, object actual) 35 | { 36 | var result = _logic.Compare(expected, actual); 37 | if (!result.AreEqual) 38 | { 39 | foreach (var difference in result.Differences) 40 | { 41 | yield return new ResultComparisonDifference( 42 | expected, 43 | actual, 44 | difference.ToString()); 45 | } 46 | } 47 | } 48 | } 49 | } 50 | #endif -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Constructor/AggregateConstructorThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET20 3 | using System.Collections.Generic; 4 | #endif 5 | #if !NET20 6 | using System.Linq; 7 | #endif 8 | 9 | namespace AggregateSource.Testing.Constructor 10 | { 11 | class AggregateConstructorThenStateBuilder : IAggregateConstructorThenStateBuilder 12 | { 13 | readonly Func _sutFactory; 14 | readonly object[] _thens; 15 | 16 | public AggregateConstructorThenStateBuilder(Func sutFactory, object[] thens) 17 | { 18 | _sutFactory = sutFactory; 19 | _thens = thens; 20 | } 21 | 22 | public IAggregateConstructorThenStateBuilder Then(params object[] events) 23 | { 24 | if (events == null) throw new ArgumentNullException("events"); 25 | #if NET20 26 | var thens = new List(_thens); 27 | thens.AddRange(events); 28 | return new AggregateConstructorThenStateBuilder(_sutFactory, thens.ToArray()); 29 | #else 30 | return new AggregateConstructorThenStateBuilder(_sutFactory, _thens.Concat(events).ToArray()); 31 | #endif 32 | } 33 | 34 | public EventCentricAggregateConstructorTestSpecification Build() 35 | { 36 | return new EventCentricAggregateConstructorTestSpecification(_sutFactory, _thens); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Constructor/AggregateConstructorThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Constructor 4 | { 5 | class AggregateConstructorThrowStateBuilder : IAggregateConstructorThrowStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly Exception _throws; 9 | 10 | public AggregateConstructorThrowStateBuilder(Func sutFactory, Exception throws) 11 | { 12 | _sutFactory = sutFactory; 13 | _throws = throws; 14 | } 15 | 16 | public ExceptionCentricAggregateConstructorTestSpecification Build() 17 | { 18 | return new ExceptionCentricAggregateConstructorTestSpecification(_sutFactory, _throws); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/EventComparisonDifference.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Represents a difference found between the expected and actual event. 5 | /// 6 | public class EventComparisonDifference 7 | { 8 | readonly object _expected; 9 | readonly object _actual; 10 | readonly string _message; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The expected event. 16 | /// The actual event. 17 | /// The message describing the difference. 18 | public EventComparisonDifference(object expected, object actual, string message) 19 | { 20 | _expected = expected; 21 | _actual = actual; 22 | _message = message; 23 | } 24 | 25 | /// 26 | /// Gets the expected event. 27 | /// 28 | /// 29 | /// The expected event. 30 | /// 31 | public object Expected 32 | { 33 | get { return _expected; } 34 | } 35 | 36 | /// 37 | /// Gets the actual event. 38 | /// 39 | /// 40 | /// The actual event. 41 | /// 42 | public object Actual 43 | { 44 | get { return _actual; } 45 | } 46 | 47 | /// 48 | /// Gets the message. 49 | /// 50 | /// 51 | /// The message. 52 | /// 53 | public string Message 54 | { 55 | get { return _message; } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/ExceptionComparisonDifference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents a difference found between the expected and actual exception. 7 | /// 8 | public class ExceptionComparisonDifference 9 | { 10 | readonly Exception _expected; 11 | readonly Exception _actual; 12 | readonly string _message; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The expected exception. 18 | /// The actual exception. 19 | /// The message describing the difference. 20 | public ExceptionComparisonDifference(Exception expected, Exception actual, string message) 21 | { 22 | _expected = expected; 23 | _actual = actual; 24 | _message = message; 25 | } 26 | 27 | /// 28 | /// Gets the expected exception. 29 | /// 30 | /// 31 | /// The expected exception. 32 | /// 33 | public Exception Expected 34 | { 35 | get { return _expected; } 36 | } 37 | 38 | /// 39 | /// Gets the actual exception. 40 | /// 41 | /// 42 | /// The actual exception. 43 | /// 44 | public Exception Actual 45 | { 46 | get { return _actual; } 47 | } 48 | 49 | /// 50 | /// Gets the message. 51 | /// 52 | /// 53 | /// The message. 54 | /// 55 | public string Message 56 | { 57 | get { return _message; } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/FactComparisonDifference.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Represents a difference found between the expected and actual fact. 5 | /// 6 | public class FactComparisonDifference 7 | { 8 | readonly Fact _expected; 9 | readonly Fact _actual; 10 | readonly string _message; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The expected fact. 16 | /// The actual fact. 17 | /// The message describing the difference. 18 | public FactComparisonDifference(Fact expected, Fact actual, string message) 19 | { 20 | _expected = expected; 21 | _actual = actual; 22 | _message = message; 23 | } 24 | 25 | /// 26 | /// Gets the expected fact. 27 | /// 28 | /// 29 | /// The expected fact. 30 | /// 31 | public Fact Expected 32 | { 33 | get { return _expected; } 34 | } 35 | 36 | /// 37 | /// Gets the actual fact. 38 | /// 39 | /// 40 | /// The actual fact. 41 | /// 42 | public Fact Actual 43 | { 44 | get { return _actual; } 45 | } 46 | 47 | /// 48 | /// Gets the message. 49 | /// 50 | /// 51 | /// The message. 52 | /// 53 | public string Message 54 | { 55 | get { return _message; } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Factory/AggregateFactoryGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Factory 4 | { 5 | class AggregateFactoryGivenNoneStateBuilder : IAggregateFactoryGivenNoneStateBuilder 6 | where TAggregateRoot : IAggregateRootEntity 7 | { 8 | readonly Func _sutFactory; 9 | 10 | public AggregateFactoryGivenNoneStateBuilder(Func sutFactory) 11 | { 12 | _sutFactory = sutFactory; 13 | } 14 | 15 | public IAggregateFactoryWhenStateBuilder When( 16 | Func factory) where TAggregateRootResult : IAggregateRootEntity 17 | { 18 | if (factory == null) throw new ArgumentNullException("factory"); 19 | return new AggregateFactoryWhenStateBuilder(_sutFactory, new object[0], root => factory((TAggregateRoot)root)); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Factory/AggregateFactoryGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET20 3 | using System.Collections.Generic; 4 | #endif 5 | #if !NET20 6 | using System.Linq; 7 | #endif 8 | 9 | namespace AggregateSource.Testing.Factory 10 | { 11 | class AggregateFactoryGivenStateBuilder : IAggregateFactoryGivenStateBuilder 12 | where TAggregateRoot : IAggregateRootEntity 13 | { 14 | readonly Func _sutFactory; 15 | readonly object[] _givens; 16 | 17 | public AggregateFactoryGivenStateBuilder(Func sutFactory, object[] givens) 18 | { 19 | _sutFactory = sutFactory; 20 | _givens = givens; 21 | } 22 | 23 | public IAggregateFactoryGivenStateBuilder Given(params object[] events) 24 | { 25 | if (events == null) throw new ArgumentNullException("events"); 26 | #if NET20 27 | var givens = new List(_givens); 28 | givens.AddRange(events); 29 | return new AggregateFactoryGivenStateBuilder(_sutFactory, givens.ToArray()); 30 | #else 31 | return new AggregateFactoryGivenStateBuilder(_sutFactory, _givens.Concat(events).ToArray()); 32 | #endif 33 | } 34 | 35 | public IAggregateFactoryWhenStateBuilder When( 36 | Func factory) where TAggregateRootResult : IAggregateRootEntity 37 | { 38 | if (factory == null) throw new ArgumentNullException("factory"); 39 | return new AggregateFactoryWhenStateBuilder(_sutFactory, _givens, root => factory((TAggregateRoot) root)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Factory/AggregateFactoryThenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Factory 4 | { 5 | class AggregateFactoryThenNoneStateBuilder : IAggregateFactoryThenNoneStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Func _when; 10 | 11 | public AggregateFactoryThenNoneStateBuilder(Func sutFactory, object[] givens, 12 | Func when) 13 | { 14 | _sutFactory = sutFactory; 15 | _givens = givens; 16 | _when = when; 17 | } 18 | 19 | 20 | public EventCentricAggregateFactoryTestSpecification Build() 21 | { 22 | return new EventCentricAggregateFactoryTestSpecification(_sutFactory, _givens, _when, new object[0]); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Factory/AggregateFactoryThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET20 3 | using System.Collections.Generic; 4 | #endif 5 | #if !NET20 6 | using System.Linq; 7 | #endif 8 | 9 | namespace AggregateSource.Testing.Factory 10 | { 11 | class AggregateFactoryThenStateBuilder : IAggregateFactoryThenStateBuilder 12 | { 13 | readonly Func _sutFactory; 14 | readonly object[] _givens; 15 | readonly Func _when; 16 | readonly object[] _thens; 17 | 18 | public AggregateFactoryThenStateBuilder(Func sutFactory, object[] givens, 19 | Func when, object[] thens) 20 | { 21 | _sutFactory = sutFactory; 22 | _givens = givens; 23 | _when = when; 24 | _thens = thens; 25 | } 26 | 27 | public IAggregateFactoryThenStateBuilder Then(params object[] events) 28 | { 29 | if (events == null) throw new ArgumentNullException("events"); 30 | #if NET20 31 | var thens = new List(_thens); 32 | thens.AddRange(events); 33 | return new AggregateFactoryThenStateBuilder(_sutFactory, _givens, _when, thens.ToArray()); 34 | #else 35 | return new AggregateFactoryThenStateBuilder(_sutFactory, _givens, _when, _thens.Concat(events).ToArray()); 36 | #endif 37 | } 38 | 39 | public EventCentricAggregateFactoryTestSpecification Build() 40 | { 41 | return new EventCentricAggregateFactoryTestSpecification(_sutFactory, _givens, _when, _thens); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Factory/AggregateFactoryThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Factory 4 | { 5 | class AggregateFactoryThrowStateBuilder : IAggregateFactoryThrowStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Func _when; 10 | readonly Exception _throws; 11 | 12 | public AggregateFactoryThrowStateBuilder(Func sutFactory, object[] givens, 13 | Func when, Exception throws) 14 | { 15 | _sutFactory = sutFactory; 16 | _givens = givens; 17 | _when = when; 18 | _throws = throws; 19 | } 20 | 21 | public ExceptionCentricAggregateFactoryTestSpecification Build() 22 | { 23 | return new ExceptionCentricAggregateFactoryTestSpecification(_sutFactory, _givens, _when, _throws); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Factory/AggregateFactoryWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Factory 4 | { 5 | class AggregateFactoryWhenStateBuilder : IAggregateFactoryWhenStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Func _when; 10 | 11 | public AggregateFactoryWhenStateBuilder(Func sutFactory, object[] givens, 12 | Func when) 13 | { 14 | _sutFactory = sutFactory; 15 | _givens = givens; 16 | _when = when; 17 | } 18 | 19 | public IAggregateFactoryThenNoneStateBuilder ThenNone() 20 | { 21 | return new AggregateFactoryThenNoneStateBuilder(_sutFactory, _givens, _when); 22 | } 23 | 24 | public IAggregateFactoryThenStateBuilder Then(params object[] events) 25 | { 26 | if (events == null) throw new ArgumentNullException("events"); 27 | return new AggregateFactoryThenStateBuilder(_sutFactory, _givens, _when, events); 28 | } 29 | 30 | public IAggregateFactoryThrowStateBuilder Throws(Exception exception) 31 | { 32 | if (exception == null) throw new ArgumentNullException("exception"); 33 | return new AggregateFactoryThrowStateBuilder(_sutFactory, _givens, _when, exception); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The given none state within the test specification building process. 7 | /// 8 | public interface IAggregateCommandGivenNoneStateBuilder 9 | where TAggregateRoot : IAggregateRootEntity 10 | { 11 | /// 12 | /// When a command occurs. 13 | /// 14 | /// The command method invocation on the sut. 15 | /// A builder continuation. 16 | IAggregateCommandWhenStateBuilder When(Action command); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The given state within the test specification building process. 7 | /// 8 | public interface IAggregateCommandGivenStateBuilder where TAggregateRoot : IAggregateRootEntity 9 | { 10 | /// 11 | /// Given the following events occured. 12 | /// 13 | /// The events that occurred. 14 | /// A builder continuation. 15 | IAggregateCommandGivenStateBuilder Given(params object[] events); 16 | 17 | /// 18 | /// When a command occurs. 19 | /// 20 | /// The command method invocation on the sut. 21 | /// A builder continuation. 22 | IAggregateCommandWhenStateBuilder When(Action command); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandInitialStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The initial state within the test specification building process. 7 | /// 8 | public interface IAggregateCommandInitialStateBuilder 9 | where TAggregateRoot : IAggregateRootEntity 10 | { 11 | /// 12 | /// Given no events occured. 13 | /// 14 | /// A builder continuation. 15 | IAggregateCommandGivenNoneStateBuilder GivenNone(); 16 | 17 | /// 18 | /// Given the following events occured. 19 | /// 20 | /// The events that occurred. 21 | /// A builder continuation. 22 | IAggregateCommandGivenStateBuilder Given(params object[] events); 23 | 24 | /// 25 | /// When a command occurs. 26 | /// 27 | /// The command method invocation on the sut. 28 | /// A builder continuation. 29 | IAggregateCommandWhenStateBuilder When(Action command); 30 | } 31 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandThenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then none state within the test specification building process. 5 | /// 6 | public interface IAggregateCommandThenNoneStateBuilder : IEventCentricAggregateCommandTestSpecificationBuilder 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then state within the test specification building process. 5 | /// 6 | public interface IAggregateCommandThenStateBuilder : IEventCentricAggregateCommandTestSpecificationBuilder 7 | { 8 | /// 9 | /// Then events should have occurred. 10 | /// 11 | /// The events that should have occurred. 12 | /// A builder continuation. 13 | IAggregateCommandThenStateBuilder Then(params object[] events); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The throw state within the test specification building process. 5 | /// 6 | public interface IAggregateCommandThrowStateBuilder : IExceptionCentricAggregateCommandTestSpecificationBuilder {} 7 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateCommandWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The when state within the test specification building process. 7 | /// 8 | public interface IAggregateCommandWhenStateBuilder 9 | { 10 | /// 11 | /// Then no events should have occurred. 12 | /// 13 | /// A builder continuation. 14 | IAggregateCommandThenNoneStateBuilder ThenNone(); 15 | 16 | /// 17 | /// Then events should have occurred. 18 | /// 19 | /// The events that should have occurred. 20 | /// A builder continuation. 21 | IAggregateCommandThenStateBuilder Then(params object[] events); 22 | 23 | /// 24 | /// Throws an exception. 25 | /// 26 | /// The exception thrown. 27 | /// A builder continuation. 28 | IAggregateCommandThrowStateBuilder Throws(Exception exception); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateConstructorThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then state within the test specification building process. 5 | /// 6 | public interface IAggregateConstructorThenStateBuilder : IEventCentricAggregateConstructorTestSpecificationBuilder 7 | { 8 | /// 9 | /// Then events should have occurred. 10 | /// 11 | /// The events that should have occurred. 12 | /// A builder continuation. 13 | IAggregateConstructorThenStateBuilder Then(params object[] events); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateConstructorThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The throw state within the test specification building process. 5 | /// 6 | public interface IAggregateConstructorThrowStateBuilder : IExceptionCentricAggregateConstructorTestSpecificationBuilder 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateConstructorWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The when state within the test specification building process. 7 | /// 8 | public interface IAggregateConstructorWhenStateBuilder 9 | { 10 | /// 11 | /// Then events should have occurred. 12 | /// 13 | /// The events that should have occurred. 14 | /// A builder continuation. 15 | IAggregateConstructorThenStateBuilder Then(params object[] events); 16 | 17 | /// 18 | /// Throws an exception. 19 | /// 20 | /// The exception thrown. 21 | /// A builder continuation. 22 | IAggregateConstructorThrowStateBuilder Throws(Exception exception); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The given none state within the test specification building process. 7 | /// 8 | public interface IAggregateFactoryGivenNoneStateBuilder where TAggregateRoot : IAggregateRootEntity 9 | { 10 | /// 11 | /// When an aggregate is created. 12 | /// 13 | /// The factory method invocation on the sut. 14 | /// A builder continuation. 15 | IAggregateFactoryWhenStateBuilder When(Func factory) 16 | where TAggregateRootResult : IAggregateRootEntity; 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The given state within the test specification building process. 7 | /// 8 | public interface IAggregateFactoryGivenStateBuilder where TAggregateRoot : IAggregateRootEntity 9 | { 10 | /// 11 | /// Given the following events occured. 12 | /// 13 | /// The events that occurred. 14 | /// A builder continuation. 15 | IAggregateFactoryGivenStateBuilder Given(params object[] events); 16 | 17 | /// 18 | /// When an aggregate is created. 19 | /// 20 | /// The factory method invocation on the sut. 21 | /// A builder continuation. 22 | IAggregateFactoryWhenStateBuilder When(Func factory) 23 | where TAggregateRootResult : IAggregateRootEntity; 24 | } 25 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryInitialStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The initial state within the test specification building process. 7 | /// 8 | public interface IAggregateFactoryInitialStateBuilder 9 | where TAggregateRoot : IAggregateRootEntity 10 | { 11 | /// 12 | /// Given no events occured. 13 | /// 14 | /// A builder continuation. 15 | IAggregateFactoryGivenNoneStateBuilder GivenNone(); 16 | 17 | /// 18 | /// Given the following events occured. 19 | /// 20 | /// The events that occurred. 21 | /// A builder continuation. 22 | IAggregateFactoryGivenStateBuilder Given(params object[] events); 23 | 24 | /// 25 | /// When an aggregate is created. 26 | /// 27 | /// The factory method invocation on the sut. 28 | /// A builder continuation. 29 | IAggregateFactoryWhenStateBuilder When(Func factory) 30 | where TAggregateRootResult : IAggregateRootEntity; 31 | } 32 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryThenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then none state within the test specification building process. 5 | /// 6 | public interface IAggregateFactoryThenNoneStateBuilder : IEventCentricAggregateFactoryTestSpecificationBuilder 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then state within the test specification building process. 5 | /// 6 | public interface IAggregateFactoryThenStateBuilder : IEventCentricAggregateFactoryTestSpecificationBuilder 7 | { 8 | /// 9 | /// Then events should have occurred. 10 | /// 11 | /// The events that should have occurred. 12 | /// A builder continuation. 13 | IAggregateFactoryThenStateBuilder Then(params object[] events); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The throw state within the test specification building process. 5 | /// 6 | public interface IAggregateFactoryThrowStateBuilder : IExceptionCentricAggregateFactoryTestSpecificationBuilder {} 7 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateFactoryWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The when state within the test specification building process. 7 | /// 8 | public interface IAggregateFactoryWhenStateBuilder 9 | { 10 | /// 11 | /// Then no events should have occurred. 12 | /// 13 | /// A builder continuation. 14 | IAggregateFactoryThenNoneStateBuilder ThenNone(); 15 | 16 | /// 17 | /// Then events should have occurred. 18 | /// 19 | /// The events that should have occurred. 20 | /// A builder continuation. 21 | IAggregateFactoryThenStateBuilder Then(params object[] events); 22 | 23 | /// 24 | /// Throws an exception. 25 | /// 26 | /// The exception thrown. 27 | /// A builder continuation. 28 | IAggregateFactoryThrowStateBuilder Throws(Exception exception); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateQueryGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The given none state within the test specification building process. 7 | /// 8 | public interface IAggregateQueryGivenNoneStateBuilder where TAggregateRoot : IAggregateRootEntity 9 | { 10 | /// 11 | /// When a query occurs. 12 | /// 13 | /// The query method invocation on the sut. 14 | /// A builder continuation. 15 | IAggregateQueryWhenStateBuilder When(Func query); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateQueryGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The given state within the test specification building process. 7 | /// 8 | public interface IAggregateQueryGivenStateBuilder where TAggregateRoot : IAggregateRootEntity 9 | { 10 | /// 11 | /// Given the following events occured. 12 | /// 13 | /// The events that occurred. 14 | /// A builder continuation. 15 | IAggregateQueryGivenStateBuilder Given(params object[] events); 16 | 17 | /// 18 | /// When a query occurs. 19 | /// 20 | /// The query method invocation on the sut. 21 | /// A builder continuation. 22 | IAggregateQueryWhenStateBuilder When(Func query); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateQueryInitialStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The initial state within the test specification building process. 7 | /// 8 | public interface IAggregateQueryInitialStateBuilder where TAggregateRoot : IAggregateRootEntity 9 | { 10 | /// 11 | /// Given no events occured. 12 | /// 13 | /// A builder continuation. 14 | IAggregateQueryGivenNoneStateBuilder GivenNone(); 15 | 16 | /// 17 | /// Given the following events occured. 18 | /// 19 | /// The events that occurred. 20 | /// A builder continuation. 21 | IAggregateQueryGivenStateBuilder Given(params object[] events); 22 | 23 | /// 24 | /// When a query occurs. 25 | /// 26 | /// The query method invocation on the sut. 27 | /// A builder continuation. 28 | IAggregateQueryWhenStateBuilder When(Func query); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateQueryThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then state within the test specification building process. 5 | /// 6 | public interface IAggregateQueryThenStateBuilder : IResultCentricAggregateQueryTestSpecificationBuilder {} 7 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateQueryThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The throw state within the test specification building process. 5 | /// 6 | public interface IAggregateQueryThrowStateBuilder : IExceptionCentricAggregateQueryTestSpecificationBuilder {} 7 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IAggregateQueryWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The when state within the test specification building process. 7 | /// 8 | public interface IAggregateQueryWhenStateBuilder 9 | { 10 | /// 11 | /// Then a result is returned. 12 | /// 13 | /// The result that should be returned. 14 | /// A builder continuation. 15 | IAggregateQueryThenStateBuilder Then(TResult result); 16 | 17 | /// 18 | /// Throws an exception. 19 | /// 20 | /// The exception thrown. 21 | /// A builder continuation. 22 | IAggregateQueryThrowStateBuilder Throws(Exception exception); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricAggregateCommandTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate command test specification runner. 7 | /// 8 | public interface IEventCentricAggregateCommandTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | EventCentricAggregateCommandTestResult Run(EventCentricAggregateCommandTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricAggregateCommandTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an event-centric aggregate command test specification. 5 | /// 6 | public interface IEventCentricAggregateCommandTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | EventCentricAggregateCommandTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricAggregateConstructorTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate constructor test specification runner. 7 | /// 8 | public interface IEventCentricAggregateConstructorTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | EventCentricAggregateConstructorTestResult Run(EventCentricAggregateConstructorTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricAggregateConstructorTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an event-centric aggregate constructor test specification. 5 | /// 6 | public interface IEventCentricAggregateConstructorTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | EventCentricAggregateConstructorTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricAggregateFactoryTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate factory test specification runner. 7 | /// 8 | public interface IEventCentricAggregateFactoryTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | EventCentricAggregateFactoryTestResult Run(EventCentricAggregateFactoryTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricAggregateFactoryTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an event-centric aggregate factory test specification. 5 | /// 6 | public interface IEventCentricAggregateFactoryTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | EventCentricAggregateFactoryTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an event-centric test specification. 5 | /// 6 | public interface IEventCentricTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | EventCentricTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricTestSpecificationRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an event centric test specification runner. 7 | /// 8 | public interface IEventCentricTestSpecificationRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | EventCentricTestResult Run(EventCentricTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventCentricTestSpecificationWriter.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Writes test specifications for human consumption. 5 | /// 6 | public interface IEventCentricTestSpecificationWriter 7 | { 8 | /// 9 | /// Writes the specified test specification. 10 | /// 11 | /// The test specification to write. 12 | void Write(EventCentricTestSpecification specification); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IEventComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Contract to compare if the expected and actual event are equal. 7 | /// 8 | public interface IEventComparer 9 | { 10 | /// 11 | /// Compares the expected to the actual event. 12 | /// 13 | /// The expected event. 14 | /// The actual event. 15 | /// An enumeration of differences, or empty if none found. 16 | IEnumerable Compare(object expected, object actual); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateCommandTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate command test specification runner. 7 | /// 8 | public interface IExceptionCentricAggregateCommandTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | ExceptionCentricAggregateCommandTestResult Run(ExceptionCentricAggregateCommandTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateCommandTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an exception-centric aggregate command test specification. 5 | /// 6 | public interface IExceptionCentricAggregateCommandTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | ExceptionCentricAggregateCommandTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateConstructorTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate constructor test specification runner. 7 | /// 8 | public interface IExceptionCentricAggregateConstructorTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | ExceptionCentricAggregateConstructorTestResult Run(ExceptionCentricAggregateConstructorTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateConstructorTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an exception-centric aggregate constructor test specification. 5 | /// 6 | public interface IExceptionCentricAggregateConstructorTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | ExceptionCentricAggregateConstructorTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateFactoryTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate factory test specification runner. 7 | /// 8 | public interface IExceptionCentricAggregateFactoryTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | ExceptionCentricAggregateFactoryTestResult Run(ExceptionCentricAggregateFactoryTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateFactoryTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an exception-centric aggregate factory test specification. 5 | /// 6 | public interface IExceptionCentricAggregateFactoryTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | ExceptionCentricAggregateFactoryTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateQueryTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate query test specification runner. 7 | /// 8 | public interface IExceptionCentricAggregateQueryTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | ExceptionCentricAggregateQueryTestResult Run(ExceptionCentricAggregateQueryTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricAggregateQueryTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an exception-centric aggregate query test specification. 5 | /// 6 | public interface IExceptionCentricAggregateQueryTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | ExceptionCentricAggregateQueryTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an exception-centric test specification. 5 | /// 6 | public interface IExceptionCentricTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | ExceptionCentricTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricTestSpecificationRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an exception centric test specification runner. 7 | /// 8 | public interface IExceptionCentricTestSpecificationRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | ExceptionCentricTestResult Run(ExceptionCentricTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionCentricTestSpecificationWriter.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Writes test specifications for human consumption. 5 | /// 6 | public interface IExceptionCentricTestSpecificationWriter 7 | { 8 | /// 9 | /// Writes the specified test specification. 10 | /// 11 | /// The test specification to write. 12 | void Write(ExceptionCentricTestSpecification specification); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IExceptionComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace AggregateSource.Testing 5 | { 6 | /// 7 | /// Contract to compare if the expected and actual exception are equal. 8 | /// 9 | public interface IExceptionComparer 10 | { 11 | /// 12 | /// Compares the expected to the actual exception. 13 | /// 14 | /// The expected exception. 15 | /// The actual exception. 16 | /// An enumeration of differences, or empty if none found. 17 | IEnumerable Compare(Exception expected, Exception actual); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IFactComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Contract to compare if the expected and actual fact are equal. 7 | /// 8 | public interface IFactComparer 9 | { 10 | /// 11 | /// Compares the expected to the actual fact. 12 | /// 13 | /// The expected fact. 14 | /// The actual fact. 15 | /// An enumeration of differences, or empty if none found. 16 | IEnumerable Compare(Fact expected, Fact actual); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IResultCentricAggregateQueryTestRunner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Represents an aggregate query test specification runner. 7 | /// 8 | public interface IResultCentricAggregateQueryTestRunner 9 | { 10 | /// 11 | /// Runs the specified test specification. 12 | /// 13 | /// The test specification to run. 14 | /// The result of running the test specification. 15 | /// Thrown when is null. 16 | ResultCentricAggregateQueryTestResult Run(ResultCentricAggregateQueryTestSpecification specification); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IResultCentricAggregateQueryTestSpecificationBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The act of building an event-centric aggregate query test specification. 5 | /// 6 | public interface IResultCentricAggregateQueryTestSpecificationBuilder 7 | { 8 | /// 9 | /// Builds the test specification thus far. 10 | /// 11 | /// The test specification. 12 | ResultCentricAggregateQueryTestSpecification Build(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IResultComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// Contract to compare if the expected and actual event are equal. 7 | /// 8 | public interface IResultComparer 9 | { 10 | /// 11 | /// Compares the expected to the actual event. 12 | /// 13 | /// The expected event. 14 | /// The actual event. 15 | /// An enumeration of differences, or empty if none found. 16 | IEnumerable Compare(object expected, object actual); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The given none state within the test specification building process. 5 | /// 6 | public interface IScenarioGivenNoneStateBuilder 7 | { 8 | /// 9 | /// When a command occurs. 10 | /// 11 | /// The command message. 12 | /// A builder continuation. 13 | IScenarioWhenStateBuilder When(object message); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The given state within the test specification building process. 5 | /// 6 | public interface IScenarioGivenStateBuilder 7 | { 8 | /// 9 | /// Given the following facts occured. 10 | /// 11 | /// The facts that occurred. 12 | /// A builder continuation. 13 | IScenarioGivenStateBuilder Given(params Fact[] facts); 14 | 15 | /// 16 | /// Given the following events occured. 17 | /// 18 | /// The aggregate identifier the events are to be associated with. 19 | /// The events that occurred. 20 | /// A builder continuation. 21 | IScenarioGivenStateBuilder Given(string identifier, params object[] events); 22 | 23 | /// 24 | /// When a command occurs. 25 | /// 26 | /// The command message. 27 | /// A builder continuation. 28 | IScenarioWhenStateBuilder When(object message); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioInitialStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The initial state within the test specification building process. 5 | /// 6 | public interface IScenarioInitialStateBuilder 7 | { 8 | /// 9 | /// Given no events occured. 10 | /// 11 | /// A builder continuation. 12 | IScenarioGivenNoneStateBuilder GivenNone(); 13 | 14 | /// 15 | /// Given the following facts occured. 16 | /// 17 | /// The facts that occurred. 18 | /// A builder continuation. 19 | IScenarioGivenStateBuilder Given(params Fact[] facts); 20 | 21 | /// 22 | /// Given the following events occured. 23 | /// 24 | /// The aggregate identifier the events are to be associated with. 25 | /// The events that occurred. 26 | /// A builder continuation. 27 | IScenarioGivenStateBuilder Given(string identifier, params object[] events); 28 | 29 | /// 30 | /// When a command occurs. 31 | /// 32 | /// The command message. 33 | /// A builder continuation. 34 | IScenarioWhenStateBuilder When(object message); 35 | } 36 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioThenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then none state within the test specification building process. 5 | /// 6 | public interface IScenarioThenNoneStateBuilder : IEventCentricTestSpecificationBuilder 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The then state within the test specification building process. 5 | /// 6 | public interface IScenarioThenStateBuilder : IEventCentricTestSpecificationBuilder 7 | { 8 | /// 9 | /// Then facts should have occurred. 10 | /// 11 | /// The facts that should have occurred. 12 | /// A builder continuation. 13 | IScenarioThenStateBuilder Then(params Fact[] facts); 14 | 15 | /// 16 | /// Then events should have occurred. 17 | /// 18 | /// The aggregate identifier the events belong to. 19 | /// The events that should have occurred. 20 | /// A builder continuation. 21 | IScenarioThenStateBuilder Then(string identifier, params object[] events); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// The throw state within the test specification building process. 5 | /// 6 | public interface IScenarioThrowStateBuilder : IExceptionCentricTestSpecificationBuilder {} 7 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/IScenarioWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing 4 | { 5 | /// 6 | /// The when state within the test specification building process. 7 | /// 8 | public interface IScenarioWhenStateBuilder : IEventCentricTestSpecificationBuilder 9 | { 10 | /// 11 | /// Then facts should have occurred. 12 | /// 13 | /// The facts that should have occurred. 14 | /// A builder continuation. 15 | IScenarioThenStateBuilder Then(params Fact[] facts); 16 | 17 | /// 18 | /// Then events should have occurred. 19 | /// 20 | /// 21 | /// The events that should have occurred. 22 | /// A builder continuation. 23 | IScenarioThenStateBuilder Then(string identifier, params object[] events); 24 | 25 | /// 26 | /// Then no events should have occurred. 27 | /// 28 | /// A builder continuation. 29 | IScenarioThenNoneStateBuilder ThenNone(); 30 | 31 | /// 32 | /// Throws an exception. 33 | /// 34 | /// The exception thrown. 35 | /// A builder continuation. 36 | IScenarioThrowStateBuilder Throws(Exception exception); 37 | } 38 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("AggregateSource.Testing")] 4 | [assembly: AssemblyDescription("AggregateSource's fluent test specification builder library.")] -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Query/AggregateQueryGivenNoneStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Query 4 | { 5 | class AggregateQueryGivenNoneStateBuilder : IAggregateQueryGivenNoneStateBuilder where TAggregateRoot : IAggregateRootEntity 6 | { 7 | readonly Func _sutFactory; 8 | 9 | public AggregateQueryGivenNoneStateBuilder(Func sutFactory) 10 | { 11 | _sutFactory = sutFactory; 12 | } 13 | 14 | public IAggregateQueryWhenStateBuilder When(Func query) 15 | { 16 | if (query == null) throw new ArgumentNullException("query"); 17 | return new AggregateQueryWhenStateBuilder(_sutFactory, new object[0], root => query((TAggregateRoot)root)); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Query/AggregateQueryGivenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | #if NET20 3 | using System.Collections.Generic; 4 | #endif 5 | #if !NET20 6 | using System.Linq; 7 | #endif 8 | 9 | namespace AggregateSource.Testing.Query 10 | { 11 | class AggregateQueryGivenStateBuilder : IAggregateQueryGivenStateBuilder 12 | where TAggregateRoot : IAggregateRootEntity 13 | { 14 | readonly Func _sutFactory; 15 | readonly object[] _givens; 16 | 17 | public AggregateQueryGivenStateBuilder(Func sutFactory, object[] givens) 18 | { 19 | _sutFactory = sutFactory; 20 | _givens = givens; 21 | } 22 | 23 | public IAggregateQueryGivenStateBuilder Given(params object[] events) 24 | { 25 | if (events == null) throw new ArgumentNullException("events"); 26 | #if NET20 27 | var givens = new List(_givens); 28 | givens.AddRange(events); 29 | return new AggregateQueryGivenStateBuilder(_sutFactory, givens.ToArray()); 30 | #else 31 | return new AggregateQueryGivenStateBuilder(_sutFactory, _givens.Concat(events).ToArray()); 32 | #endif 33 | } 34 | 35 | public IAggregateQueryWhenStateBuilder When(Func query) 36 | { 37 | if (query == null) throw new ArgumentNullException("query"); 38 | return new AggregateQueryWhenStateBuilder(_sutFactory, _givens, 39 | root => query((TAggregateRoot) root)); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Query/AggregateQueryThenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Query 4 | { 5 | class AggregateQueryThenStateBuilder : IAggregateQueryThenStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Func _when; 10 | readonly object _then; 11 | 12 | public AggregateQueryThenStateBuilder(Func sutFactory, object[] givens, 13 | Func when, object then) 14 | { 15 | _sutFactory = sutFactory; 16 | _givens = givens; 17 | _when = when; 18 | _then = then; 19 | } 20 | 21 | public ResultCentricAggregateQueryTestSpecification Build() 22 | { 23 | return new ResultCentricAggregateQueryTestSpecification(_sutFactory, _givens, _when, _then); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Query/AggregateQueryThrowStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Query 4 | { 5 | class AggregateQueryThrowStateBuilder : IAggregateQueryThrowStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Func _when; 10 | readonly Exception _throws; 11 | 12 | public AggregateQueryThrowStateBuilder(Func sutFactory, object[] givens, 13 | Func when, Exception throws) 14 | { 15 | _sutFactory = sutFactory; 16 | _givens = givens; 17 | _when = when; 18 | _throws = throws; 19 | } 20 | 21 | public ExceptionCentricAggregateQueryTestSpecification Build() 22 | { 23 | return new ExceptionCentricAggregateQueryTestSpecification(_sutFactory, _givens, _when, _throws); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/Query/AggregateQueryWhenStateBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AggregateSource.Testing.Query 4 | { 5 | class AggregateQueryWhenStateBuilder : IAggregateQueryWhenStateBuilder 6 | { 7 | readonly Func _sutFactory; 8 | readonly object[] _givens; 9 | readonly Func _when; 10 | 11 | public AggregateQueryWhenStateBuilder(Func sutFactory, object[] givens, 12 | Func when) 13 | { 14 | _sutFactory = sutFactory; 15 | _givens = givens; 16 | _when = when; 17 | } 18 | 19 | public IAggregateQueryThenStateBuilder Then(TResult result) 20 | { 21 | return new AggregateQueryThenStateBuilder(_sutFactory, _givens, _when, result); 22 | } 23 | 24 | public IAggregateQueryThrowStateBuilder Throws(Exception exception) 25 | { 26 | if (exception == null) throw new ArgumentNullException("exception"); 27 | return new AggregateQueryThrowStateBuilder(_sutFactory, _givens, _when, exception); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/ResultComparisonDifference.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Represents a difference found between the expected and actual result. 5 | /// 6 | public class ResultComparisonDifference 7 | { 8 | readonly object _expected; 9 | readonly object _actual; 10 | readonly string _message; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The expected result. 16 | /// The actual result. 17 | /// The message describing the difference. 18 | public ResultComparisonDifference(object expected, object actual, string message) 19 | { 20 | _expected = expected; 21 | _actual = actual; 22 | _message = message; 23 | } 24 | 25 | /// 26 | /// Gets the expected result. 27 | /// 28 | /// 29 | /// The expected result. 30 | /// 31 | public object Expected 32 | { 33 | get { return _expected; } 34 | } 35 | 36 | /// 37 | /// Gets the actual result. 38 | /// 39 | /// 40 | /// The actual result. 41 | /// 42 | public object Actual 43 | { 44 | get { return _actual; } 45 | } 46 | 47 | /// 48 | /// Gets the message. 49 | /// 50 | /// 51 | /// The message. 52 | /// 53 | public string Message 54 | { 55 | get { return _message; } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/State.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Represents a syntactic sugar bootstrapper to compose facts for use in the testing API. 5 | /// 6 | public static class State 7 | { 8 | /// 9 | /// Defines a set of events that happened to a particular aggregate. 10 | /// 11 | /// The aggregate identifier the events apply to. 12 | /// The events that occurred. 13 | /// A builder of facts. 14 | /// Thrown when the or is null. 15 | public static FactsBuilder That(string identifier, params object[] events) 16 | { 17 | return new FactsBuilder().That(identifier, events); 18 | } 19 | 20 | /// 21 | /// Defines a set of facts that happened. 22 | /// 23 | /// The facts that occurred. 24 | /// A builder of facts. 25 | /// Thrown when the is null. 26 | public static FactsBuilder That(params Fact[] facts) 27 | { 28 | return new FactsBuilder().That(facts); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/TestResultState.cs: -------------------------------------------------------------------------------- 1 | namespace AggregateSource.Testing 2 | { 3 | /// 4 | /// Enumeration of possible states a test specification result can be in. 5 | /// 6 | public enum TestResultState 7 | { 8 | /// 9 | /// The test specification passed 10 | /// 11 | Passed, 12 | 13 | /// 14 | /// The test specification failed 15 | /// 16 | Failed 17 | } 18 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/WrappedEventComparerEqualityComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | #if !NET20 4 | using System.Linq; 5 | #endif 6 | 7 | namespace AggregateSource.Testing 8 | { 9 | class WrappedEventComparerEqualityComparer : IEqualityComparer 10 | { 11 | readonly IEventComparer _comparer; 12 | 13 | public WrappedEventComparerEqualityComparer(IEventComparer comparer) 14 | { 15 | _comparer = comparer; 16 | } 17 | 18 | bool IEqualityComparer.Equals(object x, object y) 19 | { 20 | #if NET20 21 | using (var enumerator = _comparer.Compare(x, y).GetEnumerator()) 22 | { 23 | return !enumerator.MoveNext(); 24 | } 25 | #else 26 | return !_comparer.Compare(x, y).Any(); 27 | #endif 28 | } 29 | 30 | int IEqualityComparer.GetHashCode(object obj) 31 | { 32 | throw new NotSupportedException(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Testing/AggregateSource.Testing/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /win_run_me_first.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo ------------------------------------------------ 4 | echo Script that prepares your working copy for usage 5 | echo ------------------------------------------------ 6 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "winbuild\run_me_first.proj" /logger:FileLogger,Microsoft.Build.Engine;LogFile=winbuild\run_me_first.log 7 | pause -------------------------------------------------------------------------------- /win_run_me_right_off_the.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo ------------------------------- 4 | echo Script that builds this project 5 | echo --- RIGHT OFF THE BAT --- 6 | echo ------------------------------- 7 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "winbuild/build.proj" /target:NonInteractiveBuild /logger:FileLogger,Microsoft.Build.Engine;LogFile=winbuild/build.log 8 | pause -------------------------------------------------------------------------------- /winbuild/TransformProjectToNET40.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | v4.0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /winbuild/ci.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\.. 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /winbuild/info.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\.. 5 | $(RootPath)\src 6 | $(MSBuildProjectDirectory)\packages 7 | $(PackagesPath)\MSBuildTasks.1.5.0.214\tools 8 | 9 | 10 | 11 | 12 | 15 | 16 | 28 | 29 | -------------------------------------------------------------------------------- /winbuild/master_version.txt: -------------------------------------------------------------------------------- 1 | 0.0.308.0 -------------------------------------------------------------------------------- /winbuild/nuspec/AggregateSource.Content.ExplicitRouting.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 15 | 16 | 17 | AggregateSource.Content.ExplicitRouting 18 | 0.0.0 19 | Yves Reynhout 20 | Yves Reynhout 21 | AggregateSource.Content.ExplicitRouting 22 | false 23 | https://raw.github.com/yreynhout/AggregateSource/master/LICENSE.txt 24 | AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model. Root & entity with explicit routing. 25 | https://github.com/yreynhout/AggregateSource 26 | Upgrade all the dependencies. 27 | Copyright 2016, BitTacklr. All rights reserved. 28 | eventsourcing DDDesign 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /winbuild/nuspec/AggregateSource.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | AggregateSource 18 | 0.0.0 19 | Yves Reynhout 20 | Yves Reynhout 21 | AggregateSource 22 | false 23 | https://raw.github.com/yreynhout/AggregateSource/master/LICENSE.txt 24 | AggregateSource provides lightweight infrastructure for building an eventsourced, aggregate based domain model. 25 | https://github.com/yreynhout/AggregateSource 26 | Upgrade all the dependencies. 27 | Copyright 2016, BitTacklr. All rights reserved. 28 | eventsourcing DDDesign 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /winbuild/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /winbuild/run_build.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo ------------------------------- 4 | echo Script that builds this project 5 | echo Please make sure you've run the 6 | echo RunMeFirst.bat, well, first :-) 7 | echo ------------------------------- 8 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "build.proj" /target:Build /logger:FileLogger,Microsoft.Build.Engine;LogFile=build.log 9 | pause -------------------------------------------------------------------------------- /winbuild/run_cibuild.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo --------------------------------------------- 4 | echo Script that runs the ci build of this project 5 | echo --------------------------------------------- 6 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "ci.proj" /target:TeamCityCodeBetter /logger:FileLogger,Microsoft.Build.Engine;LogFile=ci.log 7 | pause -------------------------------------------------------------------------------- /winbuild/run_pack.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo ------------------------------- 4 | echo Script that builds this project 5 | echo Please make sure you've run the 6 | echo RunMeFirst.bat, well, first :-) 7 | echo ------------------------------- 8 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "nuget.proj" /target:Pack /logger:FileLogger,Microsoft.Build.Engine;LogFile=nuget.log 9 | pause -------------------------------------------------------------------------------- /winbuild/run_push.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo ------------------------------- 4 | echo Script that builds this project 5 | echo Please make sure you've run the 6 | echo RunMeFirst.bat, well, first :-) 7 | echo ------------------------------- 8 | set /p apikey=Enter NuGet ApiKey: 9 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "nuget.proj" /target:Push /p:NuGetApiKey=%apikey% /logger:FileLogger,Microsoft.Build.Engine;LogFile=nuget.log 10 | pause -------------------------------------------------------------------------------- /winbuild/run_test.bat: -------------------------------------------------------------------------------- 1 | cls 2 | echo off 3 | echo ------------------------------- 4 | echo Script that tests this project 5 | echo Please make sure you've run the 6 | echo RunMeFirst.bat, well, first :-) 7 | echo ------------------------------- 8 | "%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /v:n "test.proj" /target:Test /logger:FileLogger,Microsoft.Build.Engine;LogFile=test.log 9 | pause -------------------------------------------------------------------------------- /winbuild/test.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\.. 5 | $(RootPath)\src 6 | $(MSBuildProjectDirectory)\packages 7 | $(PackagesPath)\MSBuildTasks.1.5.0.214\tools 8 | 9 | 10 | 11 | 12 | 13 | 24 | 25 | 26 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /winbuild/version.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\.. 5 | $(RootPath)\src 6 | $(MSBuildProjectDirectory)\packages 7 | $(PackagesPath)\MSBuildTasks.1.5.0.214\tools 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | --------------------------------------------------------------------------------