Exemple #1
0
        public void Mixed2()
        {
            var text = "circle(radius:5), x: 100px, y: 50px, color: rgba(255, 255, 255, 10%)";

            var reader = new ArgumentReader(text);

            Assert.True(reader.TryRead(out var command));

            Assert.True(reader.TryRead(out var x));

            Assert.True(reader.TryRead(out var y));

            Assert.True(reader.TryRead(out var color));

            Assert.False(reader.TryRead(out _));

            Assert.Equal("x", x.Name);
            Assert.Equal("y", y.Name);
            Assert.Equal("color", color.Name);


            Assert.Equal("100px", x.Value);
            Assert.Equal("50px", y.Value);
            Assert.Equal("rgba(255, 255, 255, 10%)", color.Value);
        }
Exemple #2
0
        public void Mixed1()
        {
            var text = "stroke:red,fill:blue";

            var reader = new ArgumentReader(text);

            Assert.True(reader.TryRead(out var stroke));
            Assert.True(reader.TryRead(out var file));

            Assert.False(reader.TryRead(out _));

            Assert.Equal("red", stroke.Value);
        }
Exemple #3
0
        public void Single()
        {
            var text = "circle(radius:5)";

            var reader = new ArgumentReader(text);

            Assert.True(reader.TryRead(out var command));

            // var circle = command as Circle;

            // Assert.Equal(5, circle.Radius);

            Assert.False(reader.TryRead(out _));
        }