mirror of https://github.com/abpframework/abp.git
10 changed files with 110 additions and 3 deletions
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.TestApp.Testing; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Repositories |
|||
{ |
|||
public class Repository_Basic_Tests_With_Int_Pk : Repository_Basic_Tests_With_Int_Pk<AbpEntityFrameworkCoreTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.TestApp.Testing; |
|||
|
|||
namespace Volo.Abp.MemoryDb.Repositories |
|||
{ |
|||
public class Repository_Basic_Tests_With_Int_Pk : Repository_Basic_Tests_With_Int_Pk<AbpMemoryDbTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.TestApp.Testing; |
|||
|
|||
namespace Volo.Abp.MongoDB.Repositories |
|||
{ |
|||
public class Repository_Basic_Tests_With_Int_Pk : Repository_Basic_Tests_With_Int_Pk<AbpMongoDbTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Abp.TestApp.Domain |
|||
{ |
|||
public class EntityWithIntPk : AggregateRoot<int> |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public EntityWithIntPk() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public EntityWithIntPk(string name) |
|||
{ |
|||
Name = name; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
using System.Linq; |
|||
using Shouldly; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.TestApp.Domain; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.TestApp.Testing |
|||
{ |
|||
public abstract class Repository_Basic_Tests_With_Int_Pk<TStartupModule> : TestAppTestBase<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
protected readonly IRepository<EntityWithIntPk, int> EntityWithIntPkRepository; |
|||
|
|||
protected Repository_Basic_Tests_With_Int_Pk() |
|||
{ |
|||
EntityWithIntPkRepository = GetRequiredService<IRepository<EntityWithIntPk, int>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void FirstOrDefault() |
|||
{ |
|||
WithUnitOfWork(() => |
|||
{ |
|||
var entity = EntityWithIntPkRepository.FirstOrDefault(e => e.Name == "Entity1"); |
|||
entity.ShouldNotBeNull(); |
|||
entity.Name.ShouldBe("Entity1"); |
|||
}); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Get() |
|||
{ |
|||
WithUnitOfWork(() => |
|||
{ |
|||
var entity = EntityWithIntPkRepository.Get(1); |
|||
entity.ShouldNotBeNull(); |
|||
entity.Name.ShouldBe("Entity1"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue