diff --git a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs index ce96f66..56b7854 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountFileGenerator.cs @@ -75,7 +75,10 @@ public SettlementReportMonthlyAmountRowMap() Resolution.Hour => "PT1H", Resolution.Day => "P1D", Resolution.Month => "P1M", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Resolution)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Resolution), + row.Value.Resolution, + "Value does not contain a enum representation of a Resolution"), }); Map(r => r.QuantityUnit) @@ -86,7 +89,10 @@ public SettlementReportMonthlyAmountRowMap() null => string.Empty, QuantityUnit.Kwh => "KWH", QuantityUnit.Pieces => "PCS", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.QuantityUnit)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.QuantityUnit), + row.Value.QuantityUnit, + string.Empty), }); Map(r => r.Currency) @@ -95,7 +101,10 @@ public SettlementReportMonthlyAmountRowMap() .Convert(row => row.Value.Currency switch { Currency.DKK => "DKK", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Currency)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Currency), + row.Value.Currency, + "Value does not contain a enum representation of a Currency"), }); Map(r => r.Amount) @@ -112,7 +121,10 @@ public SettlementReportMonthlyAmountRowMap() ChargeType.Tariff => "D03", ChargeType.Fee => "D02", ChargeType.Subscription => "D01", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.ChargeType)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.ChargeType), + row.Value.ChargeType, + "Value does not contain a enum representation of a ChargeType"), }); Map(r => r.ChargeCode) diff --git a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs index a2b68cf..404309e 100644 --- a/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs +++ b/source/settlement-report/SettlementReports.Infrastructure/SettlementReports_v2/Generators/MonthlyAmountTotalFileGenerator.cs @@ -81,7 +81,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor Resolution.Hour => "PT1H", Resolution.Day => "P1D", Resolution.Month => "P1M", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Resolution)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Resolution), + row.Value.Resolution, + "Value does not contain a enum representation of a Resolution."), }); Map(r => r.QuantityUnit) @@ -89,9 +92,13 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor .Index(6) .Convert(row => row.Value.QuantityUnit switch { + null => string.Empty, QuantityUnit.Kwh => "KWH", QuantityUnit.Pieces => "PCS", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.QuantityUnit)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.QuantityUnit), + row.Value.QuantityUnit, + "Value does not contain a enum representation of a quantity unit."), }); Map(r => r.Currency) @@ -100,7 +107,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor .Convert(row => row.Value.Currency switch { Currency.DKK => "DKK", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.Currency)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.Currency), + row.Value.Currency, + "Value does not contain a enum representation of a Currency"), }); Map(r => r.Amount) @@ -117,7 +127,10 @@ public SettlementReportTotalMonthlyAmountRowMap(SettlementReportRequestedByActor ChargeType.Tariff => "D03", ChargeType.Fee => "D02", ChargeType.Subscription => "D01", - _ => throw new ArgumentOutOfRangeException(nameof(row.Value.ChargeType)), + _ => throw new ArgumentOutOfRangeException( + nameof(row.Value.ChargeType), + row.Value.ChargeType, + "Value does not contain a enum representation of a ChargeType."), }); Map(r => r.ChargeCode)