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
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...bp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Domain/ExtraProperties_Tests.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 Volo.Abp.TestApp.Testing; | ||
|
||
namespace Volo.Abp.EntityFrameworkCore.Domain | ||
{ | ||
public class ExtraProperties_Tests : ExtraProperties_Tests<AbpEntityFrameworkCoreTestModule> | ||
{ | ||
|
||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Domain/ExtraProperties_Tests.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 Volo.Abp.TestApp.Testing; | ||
|
||
namespace Volo.Abp.MongoDB.Domain | ||
{ | ||
public class ExtraProperties_Tests : ExtraProperties_Tests<AbpMongoDbTestModule> | ||
{ | ||
|
||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.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,53 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Shouldly; | ||
using Volo.Abp.Modularity; | ||
using Volo.Abp.TestApp.Domain; | ||
using Xunit; | ||
|
||
namespace Volo.Abp.TestApp.Testing | ||
{ | ||
public abstract class ExtraProperties_Tests<TStartupModule> : TestAppTestBase<TStartupModule> | ||
where TStartupModule : IAbpModule | ||
{ | ||
protected readonly ICityRepository CityRepository; | ||
|
||
protected ExtraProperties_Tests() | ||
{ | ||
CityRepository = GetRequiredService<ICityRepository>(); | ||
} | ||
|
||
[Fact] | ||
public async Task Should_Get_An_Extra_Property() | ||
{ | ||
var london = await CityRepository.FindByNameAsync("London"); | ||
london.ExtraProperties.ContainsKey("Population").ShouldBeTrue(); | ||
london.ExtraProperties["Population"].To<int>().ShouldBe(10_470_000); | ||
} | ||
|
||
[Fact] | ||
public async Task Should_Add_An_Extra_Property() | ||
{ | ||
var london = await CityRepository.FindByNameAsync("London"); | ||
london.ExtraProperties["AreaAsKm"] = 1572; | ||
await CityRepository.UpdateAsync(london); | ||
|
||
var london2 = await CityRepository.FindByNameAsync("London"); | ||
london2.ExtraProperties.ContainsKey("AreaAsKm").ShouldBeTrue(); | ||
london2.ExtraProperties["AreaAsKm"].To<int>().ShouldBe(1572); | ||
} | ||
|
||
[Fact] | ||
public async Task Should_Update_An_Existing_Extra_Property() | ||
{ | ||
var london = await CityRepository.FindByNameAsync("London"); | ||
|
||
london.ExtraProperties["Population"] = 11_000_042; | ||
await CityRepository.UpdateAsync(london); | ||
|
||
var london2 = await CityRepository.FindByNameAsync("London"); | ||
london2.ExtraProperties.ContainsKey("Population").ShouldBeTrue(); | ||
london2.ExtraProperties["Population"].To<int>().ShouldBe(11_000_042); | ||
} | ||
} | ||
} |