public void ThrowsOnUnexpectedDataType() { var elements = new List <PlyElement>() { new PlyElement("vertex", 1, new List <PlyProperty>() { new PlyProperty("x", PlyType.Float), }) }; var header = new PlyHeader(PlyFormat.Ascii, elements); using (var stream = new MemoryStream()) { var writer = new PlyAsciiWriter(stream, header); Assert.Throws <UnexpectedDataTypeException>(() => writer.WriteValue(12)); writer.ForceDispose(); } }
public void ThrowsWhenNotAllValuesWritten() { var elements = new List <PlyElement>() { new PlyElement("vertex", 1, new List <PlyProperty>() { new PlyProperty("x", PlyType.Float), }), new PlyElement("face", 1, new List <PlyProperty>() { new PlyArrayProperty("vertex_index", PlyType.Int, PlyType.Int) }) }; var header = new PlyHeader(PlyFormat.Ascii, elements); using (var stream = new MemoryStream()) { var writer = new PlyAsciiWriter(stream, header); writer.WriteValue(1.0f); Assert.Throws <InvalidOperationException>(() => writer.Dispose()); writer.ForceDispose(); } }