Example #1
0
        public void HandleMultiValueParam()
        {
            var p1 = new ChoiceValue(new ValueExpression[] { new StringValue("hello, world!"), new NumberValue(18.4M) });

            Assert.AreEqual(@"hello\, world!,18.4", p1.ToString());

            var p2 = ChoiceValue.Parse(@"hello\, world!,18.4");

            Assert.AreEqual(2, p2.Choices.Length);
            Assert.AreEqual("hello, world!", ((UntypedValue)p2.Choices[0]).AsStringValue().Value);
            Assert.AreEqual(18.4M, ((UntypedValue)p2.Choices[1]).AsNumberValue().Value);
        }
Example #2
0
        public void HandleComposites()
        {
            var pX = new CompositeValue(new ValueExpression[] { new StringValue("hello, world!"), new NumberValue(14.8M) });
            var pY = new TokenValue("NOK", "http://somesuch.org");
            var p1 = new ChoiceValue(new ValueExpression[] { pX, pY });

            Assert.AreEqual(@"hello\, world!$14.8,http://somesuch.org|NOK", p1.ToString());

            var crit1 = ChoiceValue.Parse(@"hello\, world$14.8,http://somesuch.org|NOK");

            Assert.AreEqual(2, crit1.Choices.Length);
            Assert.IsTrue(crit1.Choices[0] is CompositeValue);
            var comp1 = crit1.Choices[0] as CompositeValue;

            Assert.AreEqual(2, comp1.Components.Length);
            Assert.AreEqual("hello, world", ((UntypedValue)comp1.Components[0]).AsStringValue().Value);
            Assert.AreEqual(14.8M, ((UntypedValue)comp1.Components[1]).AsNumberValue().Value);
            Assert.AreEqual("http://somesuch.org|NOK", ((UntypedValue)crit1.Choices[1]).AsTokenValue().ToString());
        }
Example #3
0
		public void HandleComposites()
		{
			var pX = new CompositeValue(new ValueExpression[] { new StringValue("hello, world!"), new NumberValue(14.8M) });
			var pY = new TokenValue("NOK", "http://somesuch.org");
			var p1 = new ChoiceValue(new ValueExpression[] { pX, pY });
			Assert.AreEqual(@"hello\, world!$14.8,http://somesuch.org|NOK", p1.ToString());

			var crit1 = ChoiceValue.Parse(@"hello\, world$14.8,http://somesuch.org|NOK");
			Assert.AreEqual(2, crit1.Choices.Length);
			Assert.IsTrue(crit1.Choices[0] is CompositeValue);
			var comp1 = crit1.Choices[0] as CompositeValue;
			Assert.AreEqual(2, comp1.Components.Length);
			Assert.AreEqual("hello, world", ((UntypedValue)comp1.Components[0]).AsStringValue().Value);
			Assert.AreEqual(14.8M, ((UntypedValue)comp1.Components[1]).AsNumberValue().Value);
			Assert.AreEqual("http://somesuch.org|NOK", ((UntypedValue)crit1.Choices[1]).AsTokenValue().ToString());
		}
Example #4
0
		public void HandleMultiValueParam()
		{
			var p1 = new ChoiceValue(new ValueExpression[] { new StringValue("hello, world!"), new NumberValue(18.4M) });
			Assert.AreEqual(@"hello\, world!,18.4", p1.ToString());

			var p2 = ChoiceValue.Parse(@"hello\, world!,18.4");
			Assert.AreEqual(2, p2.Choices.Length);
			Assert.AreEqual("hello, world!", ((UntypedValue)p2.Choices[0]).AsStringValue().Value);
			Assert.AreEqual(18.4M, ((UntypedValue)p2.Choices[1]).AsNumberValue().Value);
		}