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 #33 from osoykan/dev
master
- Loading branch information
Showing
13 changed files
with
100 additions
and
15 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
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 |
---|---|---|
@@ -1,7 +1,17 @@ | ||
using Shouldly; | ||
using System.Collections.Generic; | ||
using System.Data.Entity.Core.Objects; | ||
using System.Data.Entity.Core.Objects.Internal; | ||
|
||
using Shouldly; | ||
|
||
using Stove.Configuration; | ||
using Stove.Domain.Repositories; | ||
using Stove.Domain.Uow; | ||
using Stove.Mapster; | ||
using Stove.ObjectMapping; | ||
using Stove.Tests.SampleApplication.Domain.Entities; | ||
using Stove.Tests.SampleApplication.Dtos; | ||
using Stove.Timing; | ||
|
||
using Xunit; | ||
|
||
|
@@ -24,5 +34,47 @@ public void auto_object_mapping_should_work() | |
personDto.ShouldNotBeNull(); | ||
personEntity.ShouldNotBeNull(); | ||
} | ||
|
||
[Fact] | ||
public void proxied_object_can_mapped_through_objectmapper_with_required_explicit_mapping() | ||
{ | ||
Building(builder => { }).Ok(); | ||
|
||
The<IModuleConfigurations>().StoveMapster().Configuration.RequireExplicitMapping = true; | ||
|
||
var mapper = The<IObjectMapper>(); | ||
|
||
using (IUnitOfWorkCompleteHandle uow = The<IUnitOfWorkManager>().Begin()) | ||
{ | ||
for (int i = 0; i < 10; i++) | ||
{ | ||
User user = The<IRepository<User>>().Insert(new User() | ||
{ | ||
CreationTime = Clock.Now, | ||
Name = $"Oğuzhan{i}", | ||
Surname = $"Soykan{i}", | ||
Email = $"[email protected]{i}" | ||
}); | ||
|
||
var userDto = mapper.Map<UserDto>(user); | ||
userDto.ShouldNotBeNull(); | ||
} | ||
|
||
uow.Complete(); | ||
} | ||
|
||
using (IUnitOfWorkCompleteHandle uow = The<IUnitOfWorkManager>().Begin()) | ||
{ | ||
List<User> users = The<IRepository<User>>().GetAllList(); | ||
|
||
users.ForEach(user => | ||
{ | ||
var userDto = mapper.Map<UserDto>(user); | ||
userDto.ShouldNotBeNull(); | ||
}); | ||
|
||
uow.Complete(); | ||
} | ||
} | ||
} | ||
} |
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,15 @@ | ||
using System; | ||
|
||
namespace Stove.Tests.SampleApplication.Dtos | ||
{ | ||
public class UserDto | ||
{ | ||
public virtual string Name { get; set; } | ||
|
||
public virtual string Surname { get; set; } | ||
|
||
public virtual string Email { get; set; } | ||
|
||
public virtual DateTime CreationTime { get; set; } | ||
} | ||
} |