public void GivenDiscountForVirtualProduct_WhenDeriving_ThenProductVirtualProductPriceComponentIsUpdated() { var vatRate21 = new VatRateBuilder(this.Session).WithRate(21).Build(); var virtualService = new DeliverableBasedServiceBuilder(this.Session) .WithName("virtual service") .WithVatRate(vatRate21) .Build(); var physicalService = new DeliverableBasedServiceBuilder(this.Session) .WithName("real service") .WithVatRate(vatRate21) .Build(); virtualService.AddVariant(physicalService); this.Session.Derive(); var discount = new DiscountComponentBuilder(this.Session) .WithDescription("discount") .WithPrice(10) .WithProduct(virtualService) .WithFromDate(DateTime.UtcNow) .Build(); this.Session.Derive(); Assert.Equal(1, physicalService.VirtualProductPriceComponents.Count); Assert.Contains(discount, physicalService.VirtualProductPriceComponents); Assert.False(virtualService.ExistVirtualProductPriceComponents); }
public void GivenDiscountForVirtualProduct_WhenDeriving_ThenProductVirtualProductPriceComponentIsUpdated() { var vatRegime = new VatRegimes(this.Session).BelgiumStandard; var virtualService = new DeliverableBasedServiceBuilder(this.Session) .WithName("virtual service") .WithVatRegime(vatRegime) .Build(); var physicalService = new DeliverableBasedServiceBuilder(this.Session) .WithName("real service") .WithVatRegime(vatRegime) .Build(); virtualService.AddVariant(physicalService); this.Session.Derive(); var discount = new DiscountComponentBuilder(this.Session) .WithDescription("discount") .WithPrice(10) .WithProduct(virtualService) .WithFromDate(this.Session.Now()) .Build(); this.Session.Derive(); Assert.Single(physicalService.VirtualProductPriceComponents); Assert.Contains(discount, physicalService.VirtualProductPriceComponents); Assert.False(virtualService.ExistVirtualProductPriceComponents); }
public void GivenDiscountForVirtualProduct_WhenDeriving_ThenProductVirtualProductPriceComponentIsUpdated() { var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build(); var virtualService = new DeliverableBasedServiceBuilder(this.DatabaseSession) .WithName("virtual service") .WithVatRate(vatRate21) .Build(); var physicalService = new DeliverableBasedServiceBuilder(this.DatabaseSession) .WithName("real service") .WithVatRate(vatRate21) .Build(); virtualService.AddVariant(physicalService); this.DatabaseSession.Derive(true); var discount = new DiscountComponentBuilder(this.DatabaseSession) .WithDescription("discount") .WithPrice(10) .WithProduct(virtualService) .WithFromDate(DateTime.UtcNow) .Build(); this.DatabaseSession.Derive(true); Assert.AreEqual(1, physicalService.VirtualProductPriceComponents.Count); Assert.Contains(discount, physicalService.VirtualProductPriceComponents); Assert.IsFalse(virtualService.ExistVirtualProductPriceComponents); }