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.
- Loading branch information
1 parent
87a7a2f
commit c681b34
Showing
3 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
using Stove.Domain.Repositories; | ||
using Stove.Domain.Uow; | ||
using Stove.Events.Bus; | ||
using Stove.Events.Bus.Entities; | ||
using Stove.Events.Bus.Handlers; | ||
using Stove.Extensions; | ||
|
@@ -90,6 +91,37 @@ public void uow_complete_handle_eventbus_should_work_with_repository_insert() | |
} | ||
} | ||
|
||
[Fact] | ||
public void uow_complete_handle_eventbus_should_work_with_repository_insert2() | ||
{ | ||
var uowManager = LocalResolver.Resolve<IUnitOfWorkManager>(); | ||
var userRepository = LocalResolver.Resolve<IRepository<User>>(); | ||
|
||
using (IUnitOfWorkCompleteHandle uow = uowManager.Begin()) | ||
{ | ||
for (var i = 0; i < 1000; i++) | ||
{ | ||
userRepository.Insert(new User | ||
{ | ||
Email = "[email protected]", | ||
Surname = "Sykn", | ||
Name = "Oğuz" | ||
}); | ||
} | ||
|
||
uow.Complete(); | ||
} | ||
|
||
using (IUnitOfWorkCompleteHandle uow = uowManager.Begin()) | ||
{ | ||
userRepository.GetAll().ForEach(user => user.Surname = "Soykan"); | ||
userRepository.Count(x => x.Email == "[email protected]").ShouldBe(1000); | ||
userRepository.FirstOrDefault(x => x.Email == "[email protected]").ShouldNotBeNull(); | ||
|
||
uow.Complete(); | ||
} | ||
} | ||
|
||
public class UserCreatedEventHandler : IEventHandler<EntityCreatedEventData<User>>, | ||
IEventHandler<EntityUpdatedEventData<User>>, | ||
ITransientDependency | ||
|