Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus committed Jan 25, 2018
2 parents 411ccf6 + 1f44061 commit 8e9a4e2
Show file tree
Hide file tree
Showing 654 changed files with 2,165 additions and 1,351 deletions.
69 changes: 44 additions & 25 deletions EventFlow.sln
Original file line number Diff line number Diff line change
@@ -1,75 +1,81 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow", "Source\EventFlow\EventFlow.csproj", "{11131251-778D-4D2E-BDD1-4844A789BCA9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow", "Source\EventFlow\EventFlow.csproj", "{11131251-778D-4D2E-BDD1-4844A789BCA9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MSSQL", "MSSQL", "{E4FC24C0-3EB3-4203-B4F2-0B534B42574A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Tests", "Source\EventFlow.Tests\EventFlow.Tests.csproj", "{7747E4A0-B378-46B6-837D-5E78C497B061}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Tests", "Source\EventFlow.Tests\EventFlow.Tests.csproj", "{7747E4A0-B378-46B6-837D-5E78C497B061}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.MsSql.Tests", "Source\EventFlow.MsSql.Tests\EventFlow.MsSql.Tests.csproj", "{A6F6232B-764F-4428-9EB5-CC98BE4F5E90}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.MsSql.Tests", "Source\EventFlow.MsSql.Tests\EventFlow.MsSql.Tests.csproj", "{A6F6232B-764F-4428-9EB5-CC98BE4F5E90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Owin", "Source\EventFlow.Owin\EventFlow.Owin.csproj", "{EE6F7B78-3EF1-488F-B90A-8E7F350B7D51}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Owin", "Source\EventFlow.Owin\EventFlow.Owin.csproj", "{EE6F7B78-3EF1-488F-B90A-8E7F350B7D51}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Owin", "Owin", "{9876C758-0A72-400E-A1B1-685E1C22ACB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Owin.Tests", "Source\EventFlow.Owin.Tests\EventFlow.Owin.Tests.csproj", "{2F3A5BCA-5336-4BB1-BA3D-0FEEA78C0415}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Owin.Tests", "Source\EventFlow.Owin.Tests\EventFlow.Owin.Tests.csproj", "{2F3A5BCA-5336-4BB1-BA3D-0FEEA78C0415}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.TestHelpers", "Source\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj", "{571D291C-5E4C-43AF-855F-7C4E2F318F4C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.TestHelpers", "Source\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj", "{571D291C-5E4C-43AF-855F-7C4E2F318F4C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Autofac", "Source\EventFlow.Autofac\EventFlow.Autofac.csproj", "{26F06682-3364-4C22-B9B2-2F2653D0BE0D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Autofac", "Source\EventFlow.Autofac\EventFlow.Autofac.csproj", "{26F06682-3364-4C22-B9B2-2F2653D0BE0D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EventStore", "EventStore", "{F6D62A27-50EA-4846-8F36-F3D36F52DCA6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.EventStores.EventStore", "Source\EventFlow.EventStores.EventStore\EventFlow.EventStores.EventStore.csproj", "{E42A253D-2011-4799-B55D-1D0C61E171C2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.EventStores.EventStore", "Source\EventFlow.EventStores.EventStore\EventFlow.EventStores.EventStore.csproj", "{E42A253D-2011-4799-B55D-1D0C61E171C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.EventStores.EventStore.Tests", "Source\EventFlow.EventStores.EventStore.Tests\EventFlow.EventStores.EventStore.Tests.csproj", "{BC4F0E41-6659-4D6D-9D25-1558CBA1649B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.EventStores.EventStore.Tests", "Source\EventFlow.EventStores.EventStore.Tests\EventFlow.EventStores.EventStore.Tests.csproj", "{BC4F0E41-6659-4D6D-9D25-1558CBA1649B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RabbitMQ", "RabbitMQ", "{7951DC73-5DAF-4322-9AF0-099BF5C90837}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.RabbitMQ", "Source\EventFlow.RabbitMQ\EventFlow.RabbitMQ.csproj", "{4B06F01F-ACE6-489D-A92A-012F533EFA3C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.RabbitMQ", "Source\EventFlow.RabbitMQ\EventFlow.RabbitMQ.csproj", "{4B06F01F-ACE6-489D-A92A-012F533EFA3C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.RabbitMQ.Tests", "Source\EventFlow.RabbitMQ.Tests\EventFlow.RabbitMQ.Tests.csproj", "{BC96BEAE-E84E-4C51-B66D-DA1F43EAD54A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.RabbitMQ.Tests", "Source\EventFlow.RabbitMQ.Tests\EventFlow.RabbitMQ.Tests.csproj", "{BC96BEAE-E84E-4C51-B66D-DA1F43EAD54A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Autofac", "Autofac", "{980EEDAA-1FEF-4D7C-8811-5EF1D9729773}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hangfire", "Hangfire", "{4741A405-DA64-40CC-A726-A2C48CA49DA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Hangfire", "Source\EventFlow.Hangfire\EventFlow.Hangfire.csproj", "{FB079985-722A-43C9-9F14-C7D2AFBE8826}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Hangfire", "Source\EventFlow.Hangfire\EventFlow.Hangfire.csproj", "{FB079985-722A-43C9-9F14-C7D2AFBE8826}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Hangfire.Tests", "Source\EventFlow.Hangfire.Tests\EventFlow.Hangfire.Tests.csproj", "{35180FC7-9135-4E79-8643-0FB825B40871}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Hangfire.Tests", "Source\EventFlow.Hangfire.Tests\EventFlow.Hangfire.Tests.csproj", "{35180FC7-9135-4E79-8643-0FB825B40871}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elasticsearch", "Elasticsearch", "{D6F5FF86-C3F3-443D-BEC4-11BDEC5E34FB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{7F20CC09-6988-40BC-8693-80E0F7022926}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Examples.Shipping", "Source\EventFlow.Examples.Shipping\EventFlow.Examples.Shipping.csproj", "{B07DD7F2-68EE-4BC7-8E37-E84BFA3F5B39}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Examples.Shipping", "Source\EventFlow.Examples.Shipping\EventFlow.Examples.Shipping.csproj", "{B07DD7F2-68EE-4BC7-8E37-E84BFA3F5B39}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Examples.Shipping.Queries.InMemory", "Source\EventFlow.Examples.Shipping.Queries.InMemory\EventFlow.Examples.Shipping.Queries.InMemory.csproj", "{079DC9A6-7740-476A-BC4F-D74D8D7A32AC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Examples.Shipping.Queries.InMemory", "Source\EventFlow.Examples.Shipping.Queries.InMemory\EventFlow.Examples.Shipping.Queries.InMemory.csproj", "{079DC9A6-7740-476A-BC4F-D74D8D7A32AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Examples.Shipping.Tests", "Source\EventFlow.Examples.Shipping.Tests\EventFlow.Examples.Shipping.Tests.csproj", "{A6F9C84B-27F6-4179-9768-4AA2099405FC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Examples.Shipping.Tests", "Source\EventFlow.Examples.Shipping.Tests\EventFlow.Examples.Shipping.Tests.csproj", "{A6F9C84B-27F6-4179-9768-4AA2099405FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQLite", "SQLite", "{2A71452E-15DD-4EBA-A7A1-8CC3D298097D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQL", "SQL", "{92F3C263-8C0C-4D12-B41A-452E48D2E5E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Sql", "Source\EventFlow.Sql\EventFlow.Sql.csproj", "{8EC9D877-7351-4C7E-87A8-29BBD3D7FEBB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Sql", "Source\EventFlow.Sql\EventFlow.Sql.csproj", "{8EC9D877-7351-4C7E-87A8-29BBD3D7FEBB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.MsSql", "Source\EventFlow.MsSql\EventFlow.MsSql.csproj", "{A0C8E77F-DB74-4035-B0DE-9BADDFCA5EBE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.MsSql", "Source\EventFlow.MsSql\EventFlow.MsSql.csproj", "{A0C8E77F-DB74-4035-B0DE-9BADDFCA5EBE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.SQLite", "Source\EventFlow.SQLite\EventFlow.SQLite.csproj", "{CEE8E914-B31C-4AAA-B520-CF72560D90FA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.SQLite", "Source\EventFlow.SQLite\EventFlow.SQLite.csproj", "{CEE8E914-B31C-4AAA-B520-CF72560D90FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.SQLite.Tests", "Source\EventFlow.SQLite.Tests\EventFlow.SQLite.Tests.csproj", "{E81D3BA7-E9C9-4227-840E-7B84ED6302C6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.SQLite.Tests", "Source\EventFlow.SQLite.Tests\EventFlow.SQLite.Tests.csproj", "{E81D3BA7-E9C9-4227-840E-7B84ED6302C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Sql.Tests", "Source\EventFlow.Sql.Tests\EventFlow.Sql.Tests.csproj", "{36F59228-C7DC-4799-8342-4CAF5C4E95D5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Sql.Tests", "Source\EventFlow.Sql.Tests\EventFlow.Sql.Tests.csproj", "{36F59228-C7DC-4799-8342-4CAF5C4E95D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Elasticsearch", "Source\EventFlow.Elasticsearch\EventFlow.Elasticsearch.csproj", "{404C6099-E82F-4433-8505-5479D76660CD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Elasticsearch", "Source\EventFlow.Elasticsearch\EventFlow.Elasticsearch.csproj", "{404C6099-E82F-4433-8505-5479D76660CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Elasticsearch.Tests", "Source\EventFlow.Elasticsearch.Tests\EventFlow.Elasticsearch.Tests.csproj", "{D4D7E41C-1473-4449-A128-CA4383783E6C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Elasticsearch.Tests", "Source\EventFlow.Elasticsearch.Tests\EventFlow.Elasticsearch.Tests.csproj", "{D4D7E41C-1473-4449-A128-CA4383783E6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.Autofac.Tests", "Source\EventFlow.Autofac.Tests\EventFlow.Autofac.Tests.csproj", "{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.Autofac.Tests", "Source\EventFlow.Autofac.Tests\EventFlow.Autofac.Tests.csproj", "{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCore", "AspNetCore", "{3A34F6A2-64B0-4730-A0EB-D324BC755538}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.AspNetCore", "Source\EventFlow.AspNetCore\EventFlow.AspNetCore.csproj", "{9D57E096-AA8E-40E5-A1CC-32C07B425850}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventFlow.AspNetCore.Tests", "Source\EventFlow.AspNetCore.Tests\EventFlow.AspNetCore.Tests.csproj", "{C16B0B27-6E6C-439C-8419-488B2D4D798F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -173,6 +179,14 @@ Global
{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5}.Release|Any CPU.Build.0 = Release|Any CPU
{9D57E096-AA8E-40E5-A1CC-32C07B425850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D57E096-AA8E-40E5-A1CC-32C07B425850}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D57E096-AA8E-40E5-A1CC-32C07B425850}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D57E096-AA8E-40E5-A1CC-32C07B425850}.Release|Any CPU.Build.0 = Release|Any CPU
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -201,5 +215,10 @@ Global
{404C6099-E82F-4433-8505-5479D76660CD} = {D6F5FF86-C3F3-443D-BEC4-11BDEC5E34FB}
{D4D7E41C-1473-4449-A128-CA4383783E6C} = {D6F5FF86-C3F3-443D-BEC4-11BDEC5E34FB}
{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5} = {980EEDAA-1FEF-4D7C-8811-5EF1D9729773}
{9D57E096-AA8E-40E5-A1CC-32C07B425850} = {3A34F6A2-64B0-4730-A0EB-D324BC755538}
{C16B0B27-6E6C-439C-8419-488B2D4D798F} = {3A34F6A2-64B0-4730-A0EB-D324BC755538}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {17607E2C-4E8E-45A2-85BD-0A5808E1C0F3}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2015-2017 Rasmus Mikkelsen
Copyright (c) 2015-2017 eBay Software Foundation
Copyright (c) 2015-2018 Rasmus Mikkelsen
Copyright (c) 2015-2018 eBay Software Foundation
https://github.com/eventflow/EventFlow

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ to the documentation.
* [**Event store:**](http://docs.geteventflow.net/EventStore.html)
Storage of the event stream for aggregates. Currently there is support for
these storage types.
* In-memory - only for test
* Files - only for test
* Microsoft SQL Server
* EventStore - only for test (for now) [home page](https://geteventstore.com/)
* In-memory - only for test
* Files - only for test
* Microsoft SQL Server
* EventStore - only for test (for now) [home page](https://geteventstore.com/)
* [**Subscribers:**](http://docs.geteventflow.net/Subscribers.html)
Listeners that act on specific domain events. Useful if an specific action
needs to be triggered after a domain event has been committed.
Expand Down Expand Up @@ -358,8 +358,8 @@ category.
```
The MIT License (MIT)
Copyright (c) 2015-2017 Rasmus Mikkelsen
Copyright (c) 2015-2017 eBay Software Foundation
Copyright (c) 2015-2018 Rasmus Mikkelsen
Copyright (c) 2015-2018 eBay Software Foundation
https://github.com/eventflow/EventFlow
Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
8 changes: 7 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
### New in 0.52 (not released yet)
### New in 0.53 (not released yet)

* New: Allow events to have multiple `EventVersion` attributes
* Fixed: `ReflectionHelper.CompileMethodInvocation` now recognises
`private` methods.

### New in 0.52.3178 (released 2017-11-02)

* Fixed: `.UseFilesEventStore` now uses a thread safe singleton instance for
file system persistence, making it suitable for use in multi-threaded unit
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EventFlow.AspNetCore\EventFlow.AspNetCore.csproj" />
<ProjectReference Include="..\EventFlow.Autofac\EventFlow.Autofac.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>

</Project>
116 changes: 116 additions & 0 deletions Source/EventFlow.AspNetCore.Tests/IntegrationTests/Site/SiteTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rasmus Mikkelsen
// Copyright (c) 2015-2018 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using EventFlow.Logs;
using EventFlow.TestHelpers;
using EventFlow.TestHelpers.Aggregates.Commands;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Newtonsoft.Json;
using NUnit.Framework;

namespace EventFlow.AspNetCore.Tests.IntegrationTests.Site
{
[Category(Categories.Integration)]
public class SiteTests : Test
{
private TestServer _server;
private HttpClient _client;
private ConsoleLog _log;

[SetUp]
public void SetUp()
{
_server = new TestServer(new WebHostBuilder()
.UseStartup<Startup>());
_client = _server.CreateClient();
_log = new ConsoleLog();
}

[TearDown]
public void TearDown()
{
_server.Dispose();
}

[Test]
public async Task Ping()
{
// Act
await GetAsync("thingy/ping?id=thingy-d15b1562-11f2-4645-8b1a-f8b946b566d3").ConfigureAwait(false);
await GetAsync("thingy/ping?id=thingy-d15b1562-11f2-4645-8b1a-f8b946b566d3").ConfigureAwait(false);
}

[Test]
public async Task PublishCommand()
{
// Arrange
var pingCommand = A<ThingyPingCommand>();

// Act
await PostAsync("commands/ThingyPing/1", pingCommand).ConfigureAwait(false);
}

private async Task<string> GetAsync(string url)
{
// Act
var response = await _client.GetAsync(url);

var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);


_log.Information(
"Received a '{0}' from '{1}' with this content: {2}",
response.StatusCode,
response.RequestMessage.RequestUri,
content);

response.EnsureSuccessStatusCode();

return content;
}

private async Task<string> PostAsync(string url, object obj)
{
var json = JsonConvert.SerializeObject(obj);
var stringContent = new StringContent(json, Encoding.UTF8, "application/json");

var response = await _client.PostAsync(url, stringContent);

var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

_log.Information(
"Received a '{0}' from '{1}' with this content: {2}",
response.StatusCode,
response.RequestMessage.RequestUri,
content);

response.EnsureSuccessStatusCode();

return content;
}
}
}
Loading

0 comments on commit 8e9a4e2

Please sign in to comment.