Thank you for your help, we can close this case
Hi, I'm asking why I get to valid return values for those Abp dbsets like UserAccounts but custom defined dbsets
await UsingDbContextAsync(async context => { var test1 = context.Countries.ToList(); -> return 0 var test2 = context.ChatMessages.ToList(); -> return 0 var test3 = context.UserAccounts.ToList(); -> return 4 results
});
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
What is your product version?
Not sure
What is your product type (Angular or MVC)?
angular
What is product framework type (.net framework or .net core)?
.net core
PartnerCenterDbContext.cs
public virtual DbSet<Country> Countries { get; set; }
public PartnerCenterDbContext(DbContextOptions<PartnerCenterDbContext> options)
:
base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigurePersistedGrantEntity();
}
Country_Tests.cs
public class CountryAppService_Tests : AppTestBase
{
private readonly ICountryAppService _countryService;
public CountryAppService_Tests()
{
_countryService = Resolve<ICountryAppService>();
//LoginAsHostAdmin();
}
[Fact]
public async Task US_ShouldBe491()
{
var usId = 491;
var test = await _countryService.GetCountries();
/* var us = countries.Where(c => c.Id == usId);
us.ShouldNotBe(null);
us.Count().ShouldBeGreaterThanOrEqualTo(1);*/
UsingDbContext(
context =>
{
var test2 = context.Countries.Select(b => b).ToList();
});
}
}
Country.cs
[Table("xxxCountries")]
public class Country : FullAuditedEntity
{
[Required]
[StringLength(CountryConsts.MaxNameLength, MinimumLength = CountryConsts.MinNameLength)]
public virtual string Name { get; set; }
[Required]
[StringLength(CountryConsts.MaxCodeLength, MinimumLength = CountryConsts.MinCodeLength)]
public virtual string Code { get; set; }
[Required]
[StringLength(CountryConsts.MaxCurrencyLength, MinimumLength = CountryConsts.MinCurrencyLength)]
public virtual string Currency { get; set; }
[Required]
[StringLength(CountryConsts.MaxCurrencyCodeLength, MinimumLength = CountryConsts.MinCurrencyCodeLength)]
public virtual string CurrencyCode { get; set; }
public virtual double ExchangeRate { get; set; }
public virtual int InternalId { get; set; }
}
internal class CountryConsts
{
public const int MinNameLength = 0;
public const int MaxNameLength = 50;
public const int MinCodeLength = 0;
public const int MaxCodeLength = 2;
public const int MinCurrencyLength = 0;
public const int MaxCurrencyLength = 50;
public const int MinCurrencyCodeLength = 0;
public const int MaxCurrencyCodeLength = 3;
}
I'm able to get data from dbContext in my test even though Im able to get them through Controller -> Service -> repository https://www.screencast.com/t/eGahTdZjUr is there some sort of a set up that I need to do?