private static void ConvertMoney(TargetModel.Money to, SourceModel.Money from, FhirConverter converter)
 {
     if (from != null)
     {
         to.CurrencyElement = ConvertCodeToCodeMoney(from.CodeElement, converter);
         to.ValueElement    = converter.ConvertElement <FhirDecimal, FhirDecimal>(from.ValueElement);
     }
 }
Exemple #2
0
 private static void ConvertMoney(TargetModel.Money to, SourceModel.Money from, FhirConverter converter)
 {
     if (from.Currency.HasValue)
     {
         to.System      = "urn:iso:std:iso:4217";
         to.CodeElement = new Code
         {
             Value     = from.Currency.Value.GetLiteral(),
             Extension = converter.ConvertList <Extension, Extension>(from.Extension).ToList()
         };
     }
 }
Exemple #3
0
        public void Can_ConvertElement_R3_Money_To_R4_Money()
        {
            var r3TypeInstance = new R3Model.Money
            {
                Value  = 24.45m,
                Unit   = "US$",
                System = "urn:iso:std:iso:4217",
                Code   = "USD"
            };
            var r4TypeInstance = new FhirConverter(FhirVersion.R4, FhirVersion.R3)
                                 .Convert <Money, R3Model.Money>(r3TypeInstance);

            Assert.NotNull(r4TypeInstance);
            Assert.Equal(r3TypeInstance.Value, r4TypeInstance.Value);
            Assert.Equal(Money.Currencies.USD, r4TypeInstance.Currency);
        }