VertexElementTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Graphics.Tests VertexElementTests

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

public class VertexElementTests

The VertexElementTests type exposes the following members.

Constructors

  NameDescription
Public methodVertexElementTests
Initializes a new instance of the VertexElementTests class
Top
Methods

  NameDescription
Public methodCreationWithInvalidTypeThrows
Public methodElementToString
Public methodSaveDataColor
Public methodSaveDataPoint
Public methodSaveDataVector
Top
Examples

[Test]
public void CreationWithInvalidTypeThrows()
{
    const VertexElementType InvalidType = (VertexElementType)0;
    Assert.Throws<VertexElement.ElementTypeNotYetSupported>(
        () => new VertexElement(InvalidType));
}
[Test]
public void ElementToString()
{
    var element = new VertexElement(VertexElementType.TextureUV);
    Assert.AreEqual("TextureUV*2", element.ToString());
}
[Test]
public void SaveDataColor()
{
    var element = new VertexElement(VertexElementType.TextureUV);
    using(var stream = new MemoryStream())
    {
        var writer = new BinaryWriter(stream);
        element.SaveData(writer, Color.Red);
        Assert.AreEqual(stream.Length, 4);
    }
}
[Test]
public void SaveDataVector()
{
    var element = new VertexElement(VertexElementType.TextureUV);
    using (var stream = new MemoryStream())
    {
        var writer = new BinaryWriter(stream);
        element.SaveData(writer, Vector3D.UnitX);
        Assert.AreEqual(stream.Length, 12);
    }
}
[Test]
public void SaveDataPoint()
{
    var element = new VertexElement(VertexElementType.TextureUV);
    using (var stream = new MemoryStream())
    {
        var writer = new BinaryWriter(stream);
        element.SaveData(writer, Vector2D.UnitX);
        Assert.AreEqual(stream.Length, 8);
    }
}
See Also