Browse Source

Move Insert_Should_Set_Guid_Id test method to repository test base class.

https://github.com/abpframework/abp/pull/4634#discussion_r456366756
pull/4797/head
maliming 6 years ago
parent
commit
a6329f4b41
  1. 10
      framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs
  2. 12
      framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs

10
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs

@ -64,15 +64,5 @@ namespace Volo.Abp.MongoDB.Repositories
person.Phones.Count.ShouldBe(1); person.Phones.Count.ShouldBe(1);
person.Phones.Any(p => p.PersonId == person.Id && p.Number == "1234567890").ShouldBeTrue(); person.Phones.Any(p => p.PersonId == person.Id && p.Number == "1234567890").ShouldBeTrue();
} }
[Fact]
public async Task Insert_Should_Set_Guid_Id()
{
var person = new Person(Guid.Empty, "New Person", 35);
await PersonRepository.InsertAsync(person);
person.Id.ShouldNotBe(Guid.Empty);
}
} }
} }

12
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs

@ -8,7 +8,7 @@ using Xunit;
namespace Volo.Abp.TestApp.Testing namespace Volo.Abp.TestApp.Testing
{ {
public abstract class Repository_Basic_Tests<TStartupModule> : TestAppTestBase<TStartupModule> public abstract class Repository_Basic_Tests<TStartupModule> : TestAppTestBase<TStartupModule>
where TStartupModule : IAbpModule where TStartupModule : IAbpModule
{ {
protected readonly IRepository<Person, Guid> PersonRepository; protected readonly IRepository<Person, Guid> PersonRepository;
@ -105,5 +105,15 @@ namespace Volo.Abp.TestApp.Testing
var person = await PersonRepository.FindAsync(personId); var person = await PersonRepository.FindAsync(personId);
person.ShouldNotBeNull(); person.ShouldNotBeNull();
} }
[Fact]
public async Task Insert_Should_Set_Guid_Id()
{
var person = new Person(Guid.Empty, "New Person", 35);
await PersonRepository.InsertAsync(person);
person.Id.ShouldNotBe(Guid.Empty);
}
} }
} }

Loading…
Cancel
Save