GlobalTester CustomCurrencyFormat Class


CustomCurrencyFormat Members

Defines how date values are formatted and displayed for the current user.

Constructor

  Name Description
CustomCurrencyFormat This class contains methods to set custom conventions for currency.

Methods

  Name Description
ChangeCurrencySymbol(string) String used as the local monetary symbol. The maximum number of characters allowed for this string is 12.
ChangePositiveCurrencyFormat(PositveCurrencyFormat) Position of the monetary symbol in the positive currency mode.
ChangeNegativeCurrencyFormat(NegativeCurrencyFormat) Negative currency format
ChangeCurrencyDecimalSymbol(string) Character(s) used for the decimal separator, for example, "." in "3.14" or "," in "3,14". The maximum number of characters allowed for this string is 3.
ChangeCurrencyNumberOfDigitsAfterDecimal(NumberOfDecimalDigits) Number of fractional digits for the local monetary format.
ChangeCurrencyDigitGroupingSymbol(string) Characters that are used to separate groups of digits to the left of the decimal. The maximum number of characters allowed for this string is 3.
ChangeCurrencyDigitGrouping(string) Sizes for each group of digits to the left of the decimal. An explicit size is needed for each group, and sizes are separated by semicolons. If the last value is 0, the preceding value is repeated. For example, to group thousands, specify 3;0. Indic locales group the first thousand and then group by hundreds. For example, 12,34,56,789 is represented by 3;2;0. The maximum number of characters allowed for this string is 9.

Enumerations

  Name Description
  PositveCurrencyFormat SymbolProceedsAmount - example, $1.1
AmountProceedsSymbol - example, 1.1$
SymbolSpaceAmount - example, $ 1.1
AmountSpaceSymbol - example, 1.1 $
  NegativeCurrencyFormat AmountInParenthesis - example, ($1.1)
NegativeSymbolCurrencySymbolAmount - example, -$1.1
CurrencySymbolNegativeSymbolAmount - example $-1.1
CurrencySymbolAmountNegativeSymbol - example, $1.1-
AmountNegativeSymbolInParenthesis - example, (1.1$)
NegativeSymbolAmountCurrencySymbol - example, -1.1$
AmountNegativeSymbolCurrencySymbol - example, 1.1-$
AmountCurrencySymbolNegativeSymbol - example, 1.1$-
NegativeSymbolAmountSpaceCurrencySymbol - example, -1.1 $
NegativeSymbolCurrencySymbolSapceAmount - example, -$ 1.1
AmountSpaceCurrencySymbolNegativeSymbol - example, 1.1 $-
CurrencySymbolSpaceAmountNegativeSymbol - example, $ 1.1-
CurrencySymbolSpaceNegativeSymbolAmount - example, $ -1.1
AmountNegativeSymbolSpaceCurrencySymbol - example, 1.1- $
CurrencySymbolSpaceAmountInParenthesis - example, ($ 1.1)
AmountSpaceCurrencySymbolInParenthesis - example, (1.1 $)

  NumberOfDecimalDigits  

Exceptions

Exception Condition
ArgumentOutOfRange Any string argument value exceeds the allowable range.

Remarks

These methods customize the Currency formats on the Regional and Language control panel Currency property sheet shown below. 

Currency Property Sheet 

Example

namespace CustomizeCurrencySettingsExampleScript
{
  using System;
  using TestingMentor.TestTool.GlobalTester;

  class MyTest
  {
    static
void Main()
    {
      try
      {
    
   CustomCurrencyFormat money = new CustomCurrencyFormat();

        string newCurrencySymbol = "$€¥";

        if (money.ChangeCurrencySymbol(newCurrencySymbol))
        {
          ChangePositiveCurrencyFormat(PositiveCurrencyFormat.SymbolSpaceAmount);
          // Launch AUT
       
  // Execute test
          // Oracle
        }
        else
        {
         // Currency symbol not changed

        }
      }

      catch(ArgumentOutOfRange e)
      {
        // Test script failure - (e.g. currency symbol string argument out of range)
      }

      finally
      {

        // Log test results

      }
    }

   }
}

This example changes the currency symbol and the format of the positive currency format for use in an automated test to check for international sufficiency.

References

GlobalTester Members

Also See

CustomNumberFormat Class
CustomLocation Class
CustomDateFormat Class
CustomTimeFormat Class