Пример #1
0
        public IPropertyValue Construct(Property[] properties)
        {
            var result = properties.Guard <MultipleValue>();

            if (result == null)
            {
                var values = new IPropertyValue[properties.Length];

                for (var i = 0; i < properties.Length; i++)
                {
                    var value = _converter.Construct(new[] { properties[i] });

                    if (value == null)
                    {
                        return(null);
                    }

                    values[i] = value;
                }

                result = new MultipleValue(values, Enumerable.Empty <Token>());
            }

            return(result);
        }
Пример #2
0
        public void MultipleValueTest()
        {
            // Arrange
            var number = 3;
            var value  = "Fizz";

            // Act
            var result = new MultipleValue(number, value);

            // Assert
            Assert.AreEqual(number, result.Multiple, $"Expected multiple {number}");
            Assert.AreEqual(value, result.Value, $"Expected value {value}");
        }
Пример #3
0
        public IPropertyValue Construct(CssProperty[] properties)
        {
            var result = properties.Guard<MultipleValue>();

            if (result == null)
            {
                var values = new IPropertyValue[properties.Length];

                for (var i = 0; i < properties.Length; i++)
                {
                    var value = _converter.Construct(new[] { properties[i] });

                    if (value == null)
                        return null;

                    values[i] = value;
                }

                result = new MultipleValue(values, Enumerable.Empty<CssToken>());
            }

            return result;
        }