Skip to content

Commit

Permalink
- split storage / event processing / memory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eben-roux committed Jul 2, 2017
1 parent 1678a1c commit baaf85c
Show file tree
Hide file tree
Showing 17 changed files with 290 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .build/package.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Import Project="Shuttle.Core.MSBuild.targets" />

<ItemGroup>
<Framework Include="net45-full;net451-full;net452-full;net46-full;net461-full" />
<Framework Include="net40-full;net45-full;net451-full;net452-full;net46-full;net461-full" />
<ProjectReference Include="..\$(PackageAssembly)\$(PackageAssembly).csproj" />
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions .build/package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
<releaseNotes/>
<copyright>Copyright (c) 2011-{year}, Eben Roux</copyright>
<tags>shuttle shuttle-recall shuttle-recall-tests event-sourcing</tags>
<dependencies>
<dependency id="Shuttle.Recall" version="{Shuttle.Recall-version}" />
</dependencies>
</metadata>
</package>
27 changes: 27 additions & 0 deletions Shuttle.Recall.Tests.Memory/Fakes/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
opyright (c) 2017, Eben Roux
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

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.

Neither the name of the Shuttle organization nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

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.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using Shuttle.Core.Infrastructure;

namespace Shuttle.Recall.Tests
namespace Shuttle.Recall.Tests.Memory.Fakes
{
public class MemoryPrimitiveEventRepository : IPrimitiveEventRepository
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Shuttle.Recall.Tests
namespace Shuttle.Recall.Tests.Memory.Fakes
{
public class MemoryProjectionRepository : IProjectionRepository
{
Expand Down
24 changes: 24 additions & 0 deletions Shuttle.Recall.Tests.Memory/MemoryFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Castle.Windsor;
using NUnit.Framework;
using Shuttle.Core.Castle;
using Shuttle.Core.Infrastructure;
using Shuttle.Recall.Tests.Memory.Fakes;

namespace Shuttle.Recall.Tests.Memory
{
public class MemoryFixture
{
[Test]
public void Should_be_able_to_exercise_event_store_and_processing()
{
var container = new WindsorComponentContainer(new WindsorContainer());

container.Register<IProjectionRepository, MemoryProjectionRepository>();
container.Register<IPrimitiveEventRepository, MemoryPrimitiveEventRepository>();

EventStore.Register(container, new EventStoreConfiguration());

RecallFixture.ExerciseEventProcessing(EventStore.Create(container), EventProcessor.Create(container), 60);
}
}
}
30 changes: 30 additions & 0 deletions Shuttle.Recall.Tests.Memory/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.InteropServices;

#if NET45FULL
[assembly: AssemblyTitle("Shuttle.Recall.Tests.Memory for .NET Framework 4.5")]
#endif

#if NET451FULL
[assembly: AssemblyTitle("Shuttle.Recall.Tests.Memory for .NET Framework 4.5.1")]
#endif

#if NET452FULL
[assembly: AssemblyTitle("Shuttle.Recall.Tests.Memory for .NET Framework 4.5.2")]
#endif

#if NET46FULL
[assembly: AssemblyTitle("Shuttle.Recall.Tests.Memory for .NET Framework 4.6")]
#endif

#if NET461FULL
[assembly: AssemblyTitle("Shuttle.Recall.Tests.Memory for .NET Framework 4.6.1")]
#endif

[assembly: AssemblyVersion("8.2.2.0")]
[assembly: AssemblyCopyright("Copyright © Eben Roux 2010-2015")]
[assembly: AssemblyProduct("Shuttle.Recall")]
[assembly: AssemblyCompany("Shuttle")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyInformationalVersion("8.2.2")]
[assembly: ComVisible(false)]
90 changes: 90 additions & 0 deletions Shuttle.Recall.Tests.Memory/Shuttle.Recall.Tests.Memory.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD4DA13D-C47F-4B5A-BEDA-F2966D30822E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Shuttle.Recall.Tests.Memory</RootNamespace>
<AssemblyName>Shuttle.Recall.Tests.Memory</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.0\lib\net40-client\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor, Version=3.4.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Windsor.3.4.0\lib\net40\Castle.Windsor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.7.1\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Shuttle.Core.Castle, Version=8.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Shuttle.Core.Castle.8.0.0\lib\net40-full\Shuttle.Core.Castle.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Shuttle.Core.Infrastructure, Version=8.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Shuttle.Core.Infrastructure.8.0.2\lib\net40-full\Shuttle.Core.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Shuttle.Recall, Version=8.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Shuttle.Recall.8.2.1\lib\net40-full\Shuttle.Recall.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Fakes\MemoryPrimitiveEventRepository.cs" />
<Compile Include="Fakes\MemoryProjectionRepository.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MemoryFixture.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shuttle.Recall.Tests\Shuttle.Recall.Tests.csproj">
<Project>{f4bfae4e-d7f7-4a25-a02f-05d4c47247fb}</Project>
<Name>Shuttle.Recall.Tests</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
9 changes: 9 additions & 0 deletions Shuttle.Recall.Tests.Memory/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.0" targetFramework="net40" />
<package id="Castle.Windsor" version="3.4.0" targetFramework="net40" />
<package id="NUnit" version="3.7.1" targetFramework="net40" />
<package id="Shuttle.Core.Castle" version="8.0.0" targetFramework="net40" />
<package id="Shuttle.Core.Infrastructure" version="8.0.2" targetFramework="net40" />
<package id="Shuttle.Recall" version="8.2.1" targetFramework="net40" />
</packages>
8 changes: 7 additions & 1 deletion Shuttle.Recall.Tests.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shuttle.Recall.Tests", "Shuttle.Recall.Tests\Shuttle.Recall.Tests.csproj", "{F4BFAE4E-D7F7-4A25-A02F-05D4C47247FB}"
EndProject
Expand All @@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shuttle.Recall.Tests.Memory", "Shuttle.Recall.Tests.Memory\Shuttle.Recall.Tests.Memory.csproj", "{DD4DA13D-C47F-4B5A-BEDA-F2966D30822E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,6 +36,10 @@ Global
{F4BFAE4E-D7F7-4A25-A02F-05D4C47247FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4BFAE4E-D7F7-4A25-A02F-05D4C47247FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4BFAE4E-D7F7-4A25-A02F-05D4C47247FB}.Release|Any CPU.Build.0 = Release|Any CPU
{DD4DA13D-C47F-4B5A-BEDA-F2966D30822E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD4DA13D-C47F-4B5A-BEDA-F2966D30822E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD4DA13D-C47F-4B5A-BEDA-F2966D30822E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD4DA13D-C47F-4B5A-BEDA-F2966D30822E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions Shuttle.Recall.Tests/Order/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ItemAdded AddItem(string product, double quantity, double cost)
return result;
}

public void On(ItemAdded itemAdded)
private void On(ItemAdded itemAdded)
{
Guard.AgainstNull(itemAdded, "itemAdded");

Expand All @@ -42,7 +42,7 @@ public void On(ItemAdded itemAdded)
});
}

public void On(OrderSnapshot snapshot)
private void On(OrderSnapshot snapshot)
{
Guard.AgainstNull(snapshot, "snapshot");

Expand Down
11 changes: 2 additions & 9 deletions Shuttle.Recall.Tests/OrderHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ public class OrderHandler :
private int _count;
private DateTime _timeOutDate = DateTime.MaxValue;

public bool IsComplete
{
get { return _count == 5; }
}

public bool HasTimedOut
{
get { return _timeOutDate < DateTime.Now; }
}
public bool IsComplete => _count == 5;
public bool HasTimedOut => _timeOutDate < DateTime.Now;

public void ProcessEvent(IEventHandlerContext<ItemAdded> context)
{
Expand Down
2 changes: 1 addition & 1 deletion Shuttle.Recall.Tests/OrderProcess/OrderProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public StatusChanged Fulfill()
return result;
}

public void On(StatusChanged statusChanged)
private void On(StatusChanged statusChanged)
{
Guard.AgainstNull(statusChanged, "statusChanged");

Expand Down
4 changes: 2 additions & 2 deletions Shuttle.Recall.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
[assembly: AssemblyTitle("Shuttle.Recall.Tests for .NET Framework 4.6.1")]
#endif

[assembly: AssemblyVersion("8.0.0.0")]
[assembly: AssemblyVersion("8.2.2.0")]
[assembly: AssemblyCopyright("Copyright © Eben Roux 2010-2015")]
[assembly: AssemblyProduct("Shuttle.Recall")]
[assembly: AssemblyCompany("Shuttle")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyInformationalVersion("8.0.0")]
[assembly: AssemblyInformationalVersion("8.2.2")]
[assembly: ComVisible(false)]
Loading

0 comments on commit baaf85c

Please sign in to comment.