public void testStudentMealMappings() { StudentMeal sm = new StudentMeal(); Mappings mappings = fCfg.Mappings.GetMappings("Default"); IDictionary map = new Hashtable(); map.Add("Balance", "10.55"); StringMapAdaptor sma = new StringMapAdaptor(map); mappings.MapOutbound(sma, sm); sm = (StudentMeal)AdkObjectParseHelper.WriteParseAndReturn(sm, fVersion); // Assert that the object was mapped correctly FSAmounts amounts = sm.Amounts; Assertion.AssertNotNull(amounts); FSAmount amount = amounts.ItemAt(0); Assertion.Assert(amount.Value.HasValue); Assertion.AssertEquals(10.55, amount.Value.Value); // Now, map the object back to a hashmap and assert it IDictionary restoredData = new Hashtable(); sma = new StringMapAdaptor(restoredData); mappings.MapInbound(sm, sma); assertMapsAreEqual(map, restoredData); }
/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="refId">GUID that identifies transaction details</param> ///<param name="foodserviceTransactionRefId">GUID that identifies food service transaction</param> ///<param name="amounts">Amount. This amount refers to the funds being directed inwards/ outwards from the customer's account. That is: these amounts reflect the changes to the account balances.</param> /// public FoodserviceTransactionDetails( string refId, string foodserviceTransactionRefId, FSAmounts amounts ) : base(Adk.SifVersion, FoodDTD.FOODSERVICETRANSACTIONDETAILS) { this.RefId = refId; this.FoodserviceTransactionRefId = foodserviceTransactionRefId; this.Amounts = amounts; }
/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="type">This refers to the way the payment was made.</param> ///<param name="amounts">AmountThis amount is the form of the incoming funds for this transaction. For example; the payment can be made by a credit card.</param> /// public TransactionPayMethod( TransactionPayMethodType type, FSAmounts amounts ) : base(FoodDTD.TRANSACTIONPAYMETHOD) { this.SetType( type ); this.AddAmounts( amounts ); }
/// <summary> /// Sets all FSAmounts object instances. All existing /// <c>FSAmounts</c> instances /// are removed and replaced with this list. Calling this method with the /// parameter value set to null removes all <c>FSAmountses</c>. /// </summary> /// <remarks> /// <para>Version: 2.5</para> /// <para>Since: 1.5r1</para> /// </remarks> public void SetAmountses( FSAmounts[] items) { SetChildren( FoodDTD.TRANSACTIONPAYMETHOD_AMOUNTS, items ); }
/// <summary>Adds a new <c><Amounts></c> child element.</summary> /// <param name="val">A FSAmounts object</param> /// <remarks> /// <para>The SIF specification defines the meaning of this element as: "AmountThis amount is the form of the incoming funds for this transaction. For example; the payment can be made by a credit card."</para> /// <para>Version: 2.5</para> /// <para>Since: 1.5r1</para> /// </remarks> public void AddAmounts( FSAmounts val ) { AddChild( FoodDTD.TRANSACTIONPAYMETHOD_AMOUNTS, val ); }