Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #44 from stoveproject/dev
Browse files Browse the repository at this point in the history
dev to master
  • Loading branch information
osoykan authored Jun 29, 2017
2 parents d7bf781 + ad89bb9 commit e99826e
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 25 deletions.
13 changes: 1 addition & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,4 @@ pull_requests:
build_script:
- ps: .\build.ps1 -experimental

test: off

deploy:
- provider: NuGet
on:
branch: master
api_key:
secure: liSTqN52OJQy9fZJk6gubSgYBAy4EXcEPCDSCLJ/3T9cZufzpTwvBlGPLX+iP2n9

artifacts:
- path: nupkg\*.nupkg
name: nuget-packages
test: off
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>1.1.1</VersionPrefix>
<VersionPrefix>1.1.2</VersionPrefix>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PackageIconUrl>https://raw.githubusercontent.com/osoykan/Stove/master/stove.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/osoykan/Stove</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/Stove.EntityFramework/Stove.EntityFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.1.3" />
<PackageReference Include="EntityFramework.DynamicFilters" Version="2.7.0" />
<PackageReference Include="EntityFramework.DynamicFilters" Version="2.8.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
Expand Down
6 changes: 3 additions & 3 deletions src/Stove.HangFire/Stove.HangFire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<PackageReference Include="Microsoft.Owin" Version="3.1.0" />
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" Version="3.1.0" />
<PackageReference Include="Owin" Version="1.0" />
<PackageReference Include="Hangfire" Version="1.6.13" />
<PackageReference Include="Hangfire.Core" Version="1.6.13" />
<PackageReference Include="Hangfire.SqlServer" Version="1.6.13" />
<PackageReference Include="Hangfire" Version="1.6.14" />
<PackageReference Include="Hangfire.Core" Version="1.6.14" />
<PackageReference Include="Hangfire.SqlServer" Version="1.6.14" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
Expand Down
2 changes: 1 addition & 1 deletion src/Stove.Mapster/Stove.Mapster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Mapster" Version="3.1.0" />
<PackageReference Include="Mapster" Version="3.1.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
Expand Down
2 changes: 1 addition & 1 deletion src/Stove.NLog/Stove.NLog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NLog" Version="4.4.10" />
<PackageReference Include="NLog" Version="4.4.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
Expand Down
2 changes: 1 addition & 1 deletion src/Stove.Redis/Stove.Redis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="1.2.3" />
<PackageReference Include="StackExchange.Redis" Version="1.2.4" />
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="2.2.0" />
</ItemGroup>

Expand Down
12 changes: 8 additions & 4 deletions src/Stove/Domain/Entities/AggregateRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ namespace Stove.Domain.Entities
{
public class AggregateRoot : AggregateRoot<int>, IAggregateRoot
{

}

public class AggregateRoot<TPrimaryKey> : Entity<TPrimaryKey>, IAggregateRoot<TPrimaryKey>
{
public AggregateRoot()
{
DomainEvents = new Collection<IEventData>();
}

[NotMapped]
public virtual ICollection<IEventData> DomainEvents { get; }

public AggregateRoot()
protected void Raise(IEventData @event)
{
DomainEvents = new Collection<IEventData>();
DomainEvents.Add(@event);
}
}
}
}
2 changes: 1 addition & 1 deletion src/Stove/Stove.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Castle.Core" Version="4.1.0" />
<PackageReference Include="FluentAssemblyScanner" Version="1.0.7" />
<PackageReference Include="JetBrains.Annotations" Version="10.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Nito.AsyncEx" Version="4.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" />
</ItemGroup>
Expand Down
38 changes: 38 additions & 0 deletions test/Stove.Tests.SampleApplication/AggregateRoot_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Autofac.Extras.IocManager;

using Stove.Domain.Repositories;
using Stove.Domain.Uow;
using Stove.Events.Bus.Handlers;
using Stove.Tests.SampleApplication.Domain.Entities;
using Stove.Tests.SampleApplication.Domain.Events;

using Xunit;

namespace Stove.Tests.SampleApplication
{
public class AggregateRoot_Tests : SampleApplicationTestBase
{
public AggregateRoot_Tests()
{
Building(builder => { }).Ok();
}

[Fact]
public void AggreateRoot_event_should_raise_when_Added()
{
using (IUnitOfWorkCompleteHandle uow = The<IUnitOfWorkManager>().Begin())
{
The<IRepository<Campaign>>().Insert(new Campaign("selam"));
uow.Complete();
}
}
}

public class CampaignCreatedEventHandler : IEventHandler<CampaignCreatedEvent>, ITransientDependency
{
public void HandleEvent(CampaignCreatedEvent eventData)
{
string name = eventData.Name;
}
}
}
17 changes: 17 additions & 0 deletions test/Stove.Tests.SampleApplication/Domain/Entities/Campaign.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Stove.Domain.Entities;
using Stove.Tests.SampleApplication.Domain.Events;

namespace Stove.Tests.SampleApplication.Domain.Entities
{
public class Campaign : AggregateRoot
{
public Campaign(string name)
{
Name = name;

Raise(new CampaignCreatedEvent { Name = Name });
}

public string Name { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Stove.Events.Bus;

namespace Stove.Tests.SampleApplication.Domain.Events
{
public class CampaignCreatedEvent : EventData
{
public string Name { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public SampleApplicationDbContext(DbConnection connection)
public virtual IDbSet<ProductDetail> ProductDetails { get; set; }

public virtual IDbSet<Message> Messages { get; set; }

public virtual IDbSet<Campaign> Campaigns { get; set; }
}
}

0 comments on commit e99826e

Please sign in to comment.