Triangle2D ToString Method Delta Engine Documentation

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

public override string ToString()

Return Value

Type: String
Remarks

Tests: DeltaEngine.Rendering2D.Shapes.Tests.Triangle2DTests
Examples

2 unit tests call DeltaEngine.Rendering2D.Shapes.Triangle2D.ToString
[Test]
public void Triangle2DToString()
{
    var triangle = new Triangle2D(new Vector2D(1, 2), new Vector2D(3, 4), new Vector2D(5, 6));
    Assert.AreEqual("1, 2 3, 4 5, 6", triangle.ToString());
}
[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