Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bertt committed Oct 22, 2024
1 parent fe5c614 commit fd96b2e
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 202 deletions.
44 changes: 44 additions & 0 deletions src/wkb2gltf.core.tests/GlbCreatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,50 @@ private ShaderColors GetShaderColors(int amount)
return shaderColors;
}

[Test]
public void CreateGltfWithAttributesAllNulls()
{
// arrange
var p0 = new Point(0, 0, 0);
var p1 = new Point(1, 1, 0);
var p2 = new Point(1, 0, 0);

var triangle1 = new Triangle(p0, p1, p2, 0);
var triangle2 = new Triangle(p0, p1, p2, 1);

var triangles = new List<Triangle>() { triangle1, triangle2 };

var attributes = new Dictionary<string, List<object>>();
attributes.Add("test", new List<object>() { DBNull.Value, DBNull.Value });

var bytes = TileCreator.GetTile(attributes, new List<List<Triangle>>() { triangles }, createGltf: true);

Assert.That(bytes != null);
}


[Test]
public void CreateGltfWithAttributeColumnAllNulls()
{
// arrange
var p0 = new Point(0, 0, 0);
var p1 = new Point(1, 1, 0);
var p2 = new Point(1, 0, 0);

var triangle1 = new Triangle(p0, p1, p2, 0);
var triangle2 = new Triangle(p0, p1, p2, 1);

var triangles = new List<Triangle>() { triangle1, triangle2 };

var attributes = new Dictionary<string, List<object>>();
attributes.Add("names", new List<object>() { "test0", "test1"});
attributes.Add("test", new List<object>() { DBNull.Value, DBNull.Value });

var bytes = TileCreator.GetTile(attributes, new List<List<Triangle>>() { triangles }, createGltf: true);

Assert.That(bytes != null);
}

[Test]
public void CreateGltfWithNullAttributesTest()
{
Expand Down
Loading

0 comments on commit fd96b2e

Please sign in to comment.