コード例 #1
0
        public void CanRemoveCarrier()
        {
            AddCarrier();
            EntityHelper.SetEntityId(carrierCollection.Carriers.First(), carrierId);

            carrierCollection.RemoveCarrier(carrierId);
            Assert.Equal(CarriersCount, 0);
        }
コード例 #2
0
        public async Task CanRemoveCarrier()
        {
            var notification = NotificationApplicationFactory.Create(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0);

            var address  = ObjectFactory.CreateDefaultAddress();
            var business = ObjectFactory.CreateEmptyProducerBusiness();
            var contact  = ObjectFactory.CreateEmptyContact();

            context.NotificationApplications.Add(notification);
            await context.SaveChangesAsync();

            var carrierCollection = new CarrierCollection(notification.Id);

            context.Carriers.Add(carrierCollection);
            await context.SaveChangesAsync();

            var carrier = carrierCollection.AddCarrier(business, address, contact);

            context.NotificationApplications.Add(notification);
            await context.SaveChangesAsync();

            Assert.True(carrierCollection.Carriers.Any());

            carrierCollection.RemoveCarrier(carrier.Id);
            await context.SaveChangesAsync();

            Assert.False(carrierCollection.Carriers.Any());
        }
コード例 #3
0
        public async Task CanRemoveCarrier()
        {
            var notification = NotificationApplicationFactory.Create(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0);

            var address = ObjectFactory.CreateDefaultAddress();
            var business = ObjectFactory.CreateEmptyProducerBusiness();
            var contact = ObjectFactory.CreateEmptyContact();

            context.NotificationApplications.Add(notification);
            await context.SaveChangesAsync();

            var carrierCollection = new CarrierCollection(notification.Id);
            context.Carriers.Add(carrierCollection);
            await context.SaveChangesAsync();

            var carrier = carrierCollection.AddCarrier(business, address, contact);
            context.NotificationApplications.Add(notification);
            await context.SaveChangesAsync();

            Assert.True(carrierCollection.Carriers.Any());

            carrierCollection.RemoveCarrier(carrier.Id);
            await context.SaveChangesAsync();

            Assert.False(carrierCollection.Carriers.Any());

            context.DeleteOnCommit(notification);
            context.DeleteOnCommit(carrierCollection);

            await context.SaveChangesAsync();
        }