This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from stoveproject/dev
dev to master
- Loading branch information
Showing
13 changed files
with
84 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
17
test/Stove.Tests.SampleApplication/Domain/Entities/Campaign.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/Stove.Tests.SampleApplication/Domain/Events/CampaignCreatedEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters