Пример #1
0
        protected void LocalCurrency_ExpectIsStringValueToNotMatchEuro()
        {
            // arrange
            ScalarType scalar      = new LocalCurrencyType("Germany", "de-De");
            var        valueSyntax = new StringValueNode("$10.99");

            // act
            Exception?result = Record.Exception(() => scalar.ParseLiteral(valueSyntax));

            // assert
            Assert.IsType <SerializationException>(result);
        }
Пример #2
0
        public void LocalCurrency_ParseLiteralStringValueDifferentCulture(string name, string cultureName)
        {
            // arrange
            ScalarType    scalar          = new LocalCurrencyType(name, cultureName);
            var           valueSyntax     = new StringValueNode("9.99");
            const decimal expectedDecimal = 9.99m;

            // act
            var result = (decimal)scalar.ParseLiteral(valueSyntax) !;

            // assert
            Assert.Equal(expectedDecimal, result);
        }
Пример #3
0
        protected void LocalCurrency_ExpectParseLiteralToMatchEuro()
        {
            // arrange
            ScalarType    scalar         = new LocalCurrencyType("Germany", "de-DE");
            var           valueSyntax    = new StringValueNode("24,99 €");
            const decimal expectedResult = 24.99m;

            // act
            object result = (decimal)scalar.ParseLiteral(valueSyntax) !;

            // assert
            Assert.Equal(expectedResult, result);
        }