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); }
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?"); }); }
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); }
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("(")); }
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("(")); }
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?"); }); }
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); }
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); }