private async Task AssureThatEntitiesStillTheSame() { using (var context = _container.Resolve <EntityContext>()) { var UesBasePoint = await context.UesBasePoint.FirstOrDefaultAsync(x => x.Id == _UesBasePoint.Id); AssertionExtensions.CompareSimpleProperties(_UesBasePoint, UesBasePoint); var BasePoint = await context.BasePoint.FirstOrDefaultAsync(x => x.BasePointGuid == _UesEtBasePoint.BasePointGuid); AssertionExtensions.CompareSimpleProperties(_UesEtBasePoint, BasePoint); var Ep = await context.Ep.FirstOrDefaultAsync(x => x.EpGuid == _EntityEp.EpGuid); AssertionExtensions.CompareSimpleProperties(_EntityEp, Ep); var Entity = new[] { _firstEntity, _secondEntity, _notActiveEntity, _expiredEntity, _futureEntity }; foreach (var Entity in Entity) { var dbEntity = await context.Entity.FirstOrDefaultAsync(x => x.EntityGuid == Entity.EntityGuid); AssertionExtensions.CompareSimpleProperties(Entity, dbEntity); } var EntityExpirations = Entity.SelectMany(x => x.EntityExpirations).ToList(); foreach (var EntityExpiration in EntityExpirations) { var dbEntityExpiration = await context.EntityExpiration.FirstOrDefaultAsync(x => x.EntityExpirationGuid == EntityExpiration.EntityExpirationGuid); AssertionExtensions.CompareSimpleProperties(EntityExpiration, dbEntityExpiration); } } }
public async Task EntitySalesShouldHaveCorrectMapping() { var EntitySales = await GetRepository().GetByIdWithEntityActiveOnDate(_UesBasePoint.Id, _targetSqlDate); Assert.NotNull(EntitySales); Assert.Equal(_UesBasePoint.Id, EntitySales.Id); Assert.Equal(BasePointId, EntitySales.BasePointId); Assert.Equal(_targetSqlDate, EntitySales.DateForActiveEntity); Assert.Equal(_UesBasePoint.DealCode, EntitySales.Deal.Code); var firstEntity = EntitySales.ActiveEntity.First(v => v.Number == FirstEntityNumber); AssertionExtensions.EntityAreEqual(_firstEntity, firstEntity, _UesEtBasePoint, _EntityEp); var secondEntity = EntitySales.ActiveEntity.First(v => v.Number == SecondEntityNumber); AssertionExtensions.EntityAreEqual(_secondEntity, secondEntity, _UesEtBasePoint, _EntityEp); }