private static decimal GetProfit(ApplicationData application) { return application.CalculationProfit ?? CalculationHelper.GetTotalTariffCost(application.CalculationTotalTariffCost, application.TariffPerKg, application.Weight) + (application.GetAdjustedScotchCost() ?? 0) + CalculationHelper.GetInsuranceCost(application.Value, application.InsuranceRate) + (application.GetAdjustedFactureCost() ?? 0) + (application.GetAdjustedFactureCostEx() ?? 0) + (application.GetAdjustedPickupCost() ?? 0) + (application.GetAdjustedTransitCost() ?? 0); }
private static void Validate( ClientData clientData, ApplicationAdminModel model, TransitEditModel transitModel, ApplicationData data) { data.ShouldBeEquivalentTo(model, options => options.ExcludingMissingProperties() .Excluding(x => x.PickupCost) .Excluding(x => x.CarrierId) .Excluding(x => x.CarrierName) .Excluding(x => x.InsuranceRate)); data.InsuranceRate.ShouldBeEquivalentTo(model.InsuranceRate / 100); data.GetAdjustedFactureCost().ShouldBeEquivalentTo(model.FactureCostEdited); data.GetAdjustedFactureCostEx().ShouldBeEquivalentTo(model.FactureCostExEdited); data.GetAdjustedTransitCost().ShouldBeEquivalentTo(model.TransitCostEdited); data.GetAdjustedPickupCost().ShouldBeEquivalentTo(model.PickupCostEdited); data.GetAdjustedScotchCost().ShouldBeEquivalentTo(model.ScotchCostEdited); data.CurrencyId.ShouldBeEquivalentTo(model.Currency.CurrencyId); data.ClientLegalEntity.ShouldBeEquivalentTo(clientData.LegalEntity); data.ClientNic.ShouldBeEquivalentTo(clientData.Nic); data.TransitAddress.ShouldBeEquivalentTo(transitModel.Address); data.TransitCityId.ShouldBeEquivalentTo(TestConstants.TestCityId1); data.CarrierId.ShouldBeEquivalentTo(TestConstants.TestCarrierId1); data.TransitDeliveryType.ShouldBeEquivalentTo(transitModel.DeliveryType); data.TransitMethodOfTransit.ShouldBeEquivalentTo(transitModel.MethodOfTransit); data.TransitPhone.ShouldBeEquivalentTo(transitModel.Phone); data.TransitRecipientName.ShouldBeEquivalentTo(transitModel.RecipientName); data.TransitWarehouseWorkingTime.ShouldBeEquivalentTo(transitModel.WarehouseWorkingTime); }