@@ -844,4 +844,144 @@ public void Validation_Works()
844844
845845 model . Validate ( ) ;
846846 }
847+
848+ [ Fact ]
849+ public void CopyConstructor_Works ( )
850+ {
851+ var model = new AggregatedCost
852+ {
853+ PerPriceCosts =
854+ [
855+ new ( )
856+ {
857+ Price = new Unit ( )
858+ {
859+ ID = "id" ,
860+ BillableMetric = new ( "id" ) ,
861+ BillingCycleConfiguration = new ( )
862+ {
863+ Duration = 0 ,
864+ DurationUnit = DurationUnit . Day ,
865+ } ,
866+ BillingMode = BillingMode . InAdvance ,
867+ Cadence = UnitCadence . OneTime ,
868+ CompositePriceFilters =
869+ [
870+ new ( )
871+ {
872+ Field = CompositePriceFilterField . PriceID ,
873+ Operator = CompositePriceFilterOperator . Includes ,
874+ Values = [ "string" ] ,
875+ } ,
876+ ] ,
877+ ConversionRate = 0 ,
878+ ConversionRateConfig = new SharedUnitConversionRateConfig ( )
879+ {
880+ ConversionRateType =
881+ SharedUnitConversionRateConfigConversionRateType . Unit ,
882+ UnitConfig = new ( "unit_amount" ) ,
883+ } ,
884+ CreatedAt = DateTimeOffset . Parse ( "2019-12-27T18:11:19.117Z" ) ,
885+ CreditAllocation = new ( )
886+ {
887+ AllowsRollover = true ,
888+ Currency = "currency" ,
889+ CustomExpiration = new ( )
890+ {
891+ Duration = 0 ,
892+ DurationUnit = CustomExpirationDurationUnit . Day ,
893+ } ,
894+ Filters =
895+ [
896+ new ( )
897+ {
898+ Field = Field . PriceID ,
899+ Operator = Operator . Includes ,
900+ Values = [ "string" ] ,
901+ } ,
902+ ] ,
903+ } ,
904+ Currency = "currency" ,
905+ Discount = new PercentageDiscount ( )
906+ {
907+ DiscountType = PercentageDiscountDiscountType . Percentage ,
908+ PercentageDiscountValue = 0.15 ,
909+ AppliesToPriceIds = [ "h74gfhdjvn7ujokd" , "7hfgtgjnbvc3ujkl" ] ,
910+ Filters =
911+ [
912+ new ( )
913+ {
914+ Field = PercentageDiscountFilterField . PriceID ,
915+ Operator = PercentageDiscountFilterOperator . Includes ,
916+ Values = [ "string" ] ,
917+ } ,
918+ ] ,
919+ Reason = "reason" ,
920+ } ,
921+ ExternalPriceID = "external_price_id" ,
922+ FixedPriceQuantity = 0 ,
923+ InvoicingCycleConfiguration = new ( )
924+ {
925+ Duration = 0 ,
926+ DurationUnit = DurationUnit . Day ,
927+ } ,
928+ Item = new ( ) { ID = "id" , Name = "name" } ,
929+ Maximum = new ( )
930+ {
931+ AppliesToPriceIds = [ "string" ] ,
932+ Filters =
933+ [
934+ new ( )
935+ {
936+ Field = MaximumFilterField . PriceID ,
937+ Operator = MaximumFilterOperator . Includes ,
938+ Values = [ "string" ] ,
939+ } ,
940+ ] ,
941+ MaximumAmount = "maximum_amount" ,
942+ } ,
943+ MaximumAmount = "maximum_amount" ,
944+ Metadata = new Dictionary < string , string > ( ) { { "foo" , "string" } } ,
945+ Minimum = new ( )
946+ {
947+ AppliesToPriceIds = [ "string" ] ,
948+ Filters =
949+ [
950+ new ( )
951+ {
952+ Field = MinimumFilterField . PriceID ,
953+ Operator = MinimumFilterOperator . Includes ,
954+ Values = [ "string" ] ,
955+ } ,
956+ ] ,
957+ MinimumAmount = "minimum_amount" ,
958+ } ,
959+ MinimumAmount = "minimum_amount" ,
960+ Name = "name" ,
961+ PlanPhaseOrder = 0 ,
962+ PriceType = UnitPriceType . UsagePrice ,
963+ ReplacesPriceID = "replaces_price_id" ,
964+ UnitConfig = new ( ) { UnitAmount = "unit_amount" , Prorated = true } ,
965+ DimensionalPriceConfiguration = new ( )
966+ {
967+ DimensionValues = [ "string" ] ,
968+ DimensionalPriceGroupID = "dimensional_price_group_id" ,
969+ } ,
970+ } ,
971+ PriceID = "price_id" ,
972+ Subtotal = "subtotal" ,
973+ Total = "total" ,
974+ Quantity = 0 ,
975+ } ,
976+ ] ,
977+ Subtotal = "subtotal" ,
978+ TimeframeEnd = DateTimeOffset . Parse ( "2019-12-27T18:11:19.117Z" ) ,
979+ TimeframeStart = DateTimeOffset . Parse ( "2019-12-27T18:11:19.117Z" ) ,
980+ Total = "total" ,
981+ } ;
982+
983+ AggregatedCost copied = new ( model ) ;
984+
985+ Assert . Equal ( model , copied ) ;
986+ }
847987}
0 commit comments