public async Task TestDirectoryMapping1() { //Arrange var contextFactory = new SqliteInMemoryContextFactory <DirectoryContext>(); //Act using (var ctx = contextFactory.ConstructContext()) { var rec = await ctx.Submisions .Include(e => e.HomeAddress) .ThenInclude(add => add.State) .Include(e => e.HomePhone) .Include(e => e.AdultTwoMobilePhone) .Include(e => e.AdultTwoMobilePhone) .Include(e => e.AdultOneEmail) .Include(e => e.AdultTwoEmail) .FirstOrDefaultAsync(s => s.Id == 1); //Assert Assert.IsNotNull(rec, "should be 1 record"); Assert.IsInstanceOfType(rec, typeof(SubmisionEntitiy), "Should be true"); Assert.IsNotNull(rec.HomeAddress, "Should load this child table"); Assert.IsNotNull(rec.HomeAddress.State, "Should load this child table"); Assert.IsNotNull(rec.HomePhone, "Should load this child table"); Assert.IsNotNull(rec.AdultTwoMobilePhone, "Should load this child table"); Assert.IsNotNull(rec.AdultTwoMobilePhone, "Should load this child table"); Assert.IsNotNull(rec.AdultOneEmail, "Should load this child table"); Assert.IsNotNull(rec.AdultTwoEmail, "Should load this child table"); } }
public async Task TestLoggingMapping1() { //Arrange var contextFactory = new SqliteInMemoryContextFactory <LogContext>(); //Act using (var ctx = contextFactory.ConstructContext()) { var recs = await ctx.LogHeaders .Include(e => e.Details) .ToListAsync(); var rec = recs.FirstOrDefault(); //Assert Assert.IsNotNull(recs, "should be 1 record"); Assert.AreEqual(1, recs.Count, "should be 1 record"); Assert.IsInstanceOfType(recs, typeof(List <LogHeaderEntity>), "Should be equal"); Assert.IsNotNull(rec, "should be 1 record"); Assert.IsInstanceOfType(rec, typeof(LogHeaderEntity), "Should be equal"); Assert.IsNotNull(rec.Details, "should be 2 records"); Assert.AreEqual(2, rec.Details.Count, "should be 2 records"); Assert.IsInstanceOfType(rec.Details, typeof(ICollection <LogDetailEntity>), "Should be equal"); } }
public async Task TestLocalizationMapping1() { //Arrange var contextFactory = new SqliteInMemoryContextFactory <LocalizationContext>(); //Act using (var ctx = contextFactory.ConstructContext()) { var recs = await ctx.Translations.ToListAsync(); //Assert Assert.IsNotNull(recs, "should be 5 records"); Assert.IsInstanceOfType(recs, typeof(List <LocalizationValueEntity>), "Should be true"); Assert.AreEqual(5, recs.Count, "Should be 5 records"); } }