Browse Source

Remove the repository test sample.

pull/119/head 2.2.3
gdlcf88 5 years ago
parent
commit
6a56e6c05f
  1. 44
      samples/EShopSample/aspnet-core/test/EShopSample.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs

44
samples/EShopSample/aspnet-core/test/EShopSample.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs

@ -1,44 +0,0 @@
using Microsoft.EntityFrameworkCore;
using EShopSample.Users;
using Shouldly;
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace EShopSample.EntityFrameworkCore.Samples
{
/* This is just an example test class.
* Normally, you don't test ABP framework code
* (like default AppUser repository IRepository<AppUser, Guid> here).
* Only test your custom repository methods.
*/
public class SampleRepositoryTests : EShopSampleEntityFrameworkCoreTestBase
{
private readonly IRepository<AppUser, Guid> _appUserRepository;
public SampleRepositoryTests()
{
_appUserRepository = GetRequiredService<IRepository<AppUser, Guid>>();
}
[Fact]
public async Task Should_Query_AppUser()
{
/* Need to manually start Unit Of Work because
* FirstOrDefaultAsync should be executed while db connection / context is available.
*/
await WithUnitOfWorkAsync(async () =>
{
//Act
var adminUser = await _appUserRepository
.Where(u => u.UserName == "admin")
.FirstOrDefaultAsync();
//Assert
adminUser.ShouldNotBeNull();
});
}
}
}
Loading…
Cancel
Save