public MonetaryValue( Iso4217CurrencyCode currency, int amount, int exponent) { this.currency = currency; this.amount = new DerInteger(amount); this.exponent = new DerInteger(exponent); }
private MonetaryValue( Asn1Sequence seq) { if (seq.Count != 3) throw new ArgumentException("Bad sequence size: " + seq.Count, "seq"); currency = Iso4217CurrencyCode.GetInstance(seq[0]); amount = DerInteger.GetInstance(seq[1]); exponent = DerInteger.GetInstance(seq[2]); }
private MonetaryValue(Asn1Sequence seq) { if (seq.Count != 3) { throw new ArgumentException("Bad sequence size: " + seq.Count, "seq"); } this.currency = Iso4217CurrencyCode.GetInstance(seq[0]); this.amount = DerInteger.GetInstance(seq[1]); this.exponent = DerInteger.GetInstance(seq[2]); }
private MonetaryValue(Asn1Sequence seq) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (seq.Count != 3) { throw new ArgumentException(string.Concat((object)"Bad sequence size: ", (object)seq.Count), "seq"); } currency = Iso4217CurrencyCode.GetInstance(seq[0]); amount = DerInteger.GetInstance(seq[1]); exponent = DerInteger.GetInstance(seq[2]); }
public override void PerformTest() { // // alphabetic // Iso4217CurrencyCode cc = new Iso4217CurrencyCode(AlphabeticCurrencyCode); CheckNumeric(cc, AlphabeticCurrencyCode); cc = Iso4217CurrencyCode.GetInstance(cc); CheckNumeric(cc, AlphabeticCurrencyCode); Asn1Object obj = cc.ToAsn1Object(); cc = Iso4217CurrencyCode.GetInstance(obj); CheckNumeric(cc, AlphabeticCurrencyCode); // // numeric // cc = new Iso4217CurrencyCode(NUMERIC_CurrencyCode); CheckNumeric(cc, NUMERIC_CurrencyCode); cc = Iso4217CurrencyCode.GetInstance(cc); CheckNumeric(cc, NUMERIC_CurrencyCode); obj = cc.ToAsn1Object(); cc = Iso4217CurrencyCode.GetInstance(obj); CheckNumeric(cc, NUMERIC_CurrencyCode); cc = Iso4217CurrencyCode.GetInstance(null); if (cc != null) { Fail("null GetInstance() failed."); } try { Iso4217CurrencyCode.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } catch (ArgumentException) { // expected } try { new Iso4217CurrencyCode("ABCD"); Fail("constructor failed to detect out of range currencycode."); } catch (ArgumentException) { // expected } try { new Iso4217CurrencyCode(0); Fail("constructor failed to detect out of range small numeric code."); } catch (ArgumentException) { // expected } try { new Iso4217CurrencyCode(1000); Fail("constructor failed to detect out of range large numeric code."); } catch (ArgumentException) { // expected } }
private void CheckNumeric( Iso4217CurrencyCode cc, int code) { if (cc.IsAlphabetic) { Fail("alphabetic code found when one not expected."); } if (cc.Numeric != code) { Fail("numeric codes don't match."); } }
private void CheckNumeric( Iso4217CurrencyCode cc, string code) { if (!cc.IsAlphabetic) { Fail("non-alphabetic code found when one expected."); } if (!cc.Alphabetic.Equals(code)) { Fail("string codes don't match."); } }