Example #1
0
        public void ConvertToStringAndBackVector2D()
        {
            var rangeGraph          = new RangeGraph <Vector2D>(Vector2D.UnitX, Vector2D.UnitY);
            var stringGraph         = rangeGraph.ToString();
            var retrievedRangeGraph = new RangeGraph <Vector2D>(stringGraph);

            Assert.AreEqual("({1, 0}, {0, 1})", stringGraph);
            Assert.AreEqual(rangeGraph.Values, retrievedRangeGraph.Values);
        }
Example #2
0
        public void ConvertingFromInvalidStringThrows()
        {
            var rangeGraph  = new RangeGraph <Color>(new[] { Color.Red, Color.Black, Color.Green });
            var stringGraph = rangeGraph.ToString();

            Assert.Throws <Range <Vector3D> .TypeInStringNotEqualToInitializedType>(
                () => { new RangeGraph <Vector3D>(stringGraph); });
            Assert.Throws <Range <Vector3D> .InvalidStringFormat>(
                () => { new RangeGraph <Vector3D>("rect, 123, que?"); });
        }
Example #3
0
        public void ConvertToStringAndBackColors()
        {
            var rangeGraph     = new RangeGraph <Color>(new[] { Color.Red, Color.Black, Color.Green });
            var stringGraph    = rangeGraph.ToString();
            var retrievedGraph = new RangeGraph <Color>(stringGraph);

            Assert.AreEqual(
                "({R=255, G=0, B=0, A=255}, {R=0, G=0, B=0, A=255}, {R=0, G=255, B=0, A=255})", stringGraph);
            Assert.AreEqual(rangeGraph.Values, retrievedGraph.Values);
        }
Example #4
0
		public void GraphOfRanges()
		{
			var ranges = new[]
			{
				new Range<Color>(Color.Red, Color.Orange), new Range<Color>(Color.Orange, Color.Gold),
				new Range<Color>(Color.Gold, Color.Yellow)
			};
			var rangesGraph = new RangeGraph<Range<Color>>(ranges[0], ranges[2]);
			rangesGraph.AddValueAfter(0, ranges[1]);
			Assert.AreEqual(ranges, rangesGraph.Values);
			Assert.IsTrue(rangesGraph.ToString().StartsWith("("));
		}
Example #5
0
        public void GraphOfRanges()
        {
            var ranges = new[]
            {
                new Range <Color>(Color.Red, Color.Orange), new Range <Color>(Color.Orange, Color.Gold),
                new Range <Color>(Color.Gold, Color.Yellow)
            };
            var rangesGraph = new RangeGraph <Range <Color> >(ranges[0], ranges[2]);

            rangesGraph.AddValueAfter(0, ranges[1]);
            Assert.AreEqual(ranges, rangesGraph.Values);
            Assert.IsTrue(rangesGraph.ToString().StartsWith("("));
        }
Example #6
0
		public void ConvertingFromInvalidStringThrows()
		{
			var rangeGraph = new RangeGraph<Color>(new[] { Color.Red, Color.Black, Color.Green });
			var stringGraph = rangeGraph.ToString();
			Assert.Throws<Range<Vector3D>.TypeInStringNotEqualToInitializedType>(
				() => { new RangeGraph<Vector3D>(stringGraph); });
			Assert.Throws<Range<Vector3D>.InvalidStringFormat>(
				() => { new RangeGraph<Vector3D>("rect, 123, que?"); });
		}
Example #7
0
		public void ConvertToStringAndBackColors()
		{
			var rangeGraph = new RangeGraph<Color>(new[] { Color.Red, Color.Black, Color.Green });
			var stringGraph = rangeGraph.ToString();
			var retrievedGraph = new RangeGraph<Color>(stringGraph);
			Assert.AreEqual(
				"({R=255, G=0, B=0, A=255}, {R=0, G=0, B=0, A=255}, {R=0, G=255, B=0, A=255})", stringGraph);
			Assert.AreEqual(rangeGraph.Values, retrievedGraph.Values);
		}
Example #8
0
		public void ConvertToStringAndBackVector2D()
		{
			var rangeGraph = new RangeGraph<Vector2D>(Vector2D.UnitX, Vector2D.UnitY);
			var stringGraph = rangeGraph.ToString();
			var retrievedRangeGraph = new RangeGraph<Vector2D>(stringGraph);
			Assert.AreEqual("({1, 0}, {0, 1})", stringGraph);
			Assert.AreEqual(rangeGraph.Values, retrievedRangeGraph.Values);
		}