Triangle2DTests Triangle2DToStringAndFromString Method Delta Engine Documentation

Namespace: DeltaEngine.Rendering2D.Shapes.Tests
Assembly: DeltaEngine.Rendering2D.Shapes.Tests (in DeltaEngine.Rendering2D.Shapes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void Triangle2DToStringAndFromString()
Examples

[Test]
public void Triangle2DToStringAndFromString()
{
    var triangle = new Triangle2D(new Vector2D(1.2f, 2.3f), new Vector2D(-3.4f, 4.5f),
        new Vector2D(0.0f, -5.67f));
    string triangleString = triangle.ToString();
    Assert.AreEqual(triangle, new Triangle2D(triangleString));
    Assert.Throws<Triangle2D.InvalidNumberOfComponents>(() => new Triangle2D("1, 2, 3"));
    Assert.Throws<FormatException>(() => new Triangle2D("abc"));
}
See Also