public void RenderMaterial_DefaultConstructedMaterialsGeneratesTheSameMaterialID() { RenderMaterial mat = new RenderMaterial(); RenderMaterial mat2 = new RenderMaterial(); UUID matID = RenderMaterial.GenerateMaterialID(mat); UUID mat2ID = RenderMaterial.GenerateMaterialID(mat2); Assert.That(mat, Is.EqualTo(mat2)); Assert.That(matID, Is.EqualTo(mat2ID)); }
public void RenderMaterial_CopiedMaterialGeneratesTheSameMaterialID() { RenderMaterial mat = new RenderMaterial(); RenderMaterial matCopy = (RenderMaterial)mat.Clone(); UUID matID = RenderMaterial.GenerateMaterialID(mat); UUID matCopyID = RenderMaterial.GenerateMaterialID(matCopy); Assert.That(mat, Is.EqualTo(matCopy)); Assert.That(matID, Is.EqualTo(matCopyID)); }
public void RenderMaterial_DifferentMaterialsGeneratesDifferentMaterialID() { RenderMaterial mat = new RenderMaterial(); RenderMaterial mat2 = new RenderMaterial(); mat2.NormalID = UUID.Random(); Assert.AreNotEqual(mat, mat2); UUID matID = RenderMaterial.GenerateMaterialID(mat); UUID mat2ID = RenderMaterial.GenerateMaterialID(mat2); Assert.AreNotEqual(matID, mat2ID); }
public void RenderMaterial_SerializedMaterialGeneratesTheSameMaterialID() { RenderMaterial mat = new RenderMaterial(); UUID matID = new UUID(mat.ComputeMD5Hash(), 0); byte[] matData = mat.ToBytes(); RenderMaterial newmat = RenderMaterial.FromBytes(matData, 0, matData.Length); UUID newmatID = RenderMaterial.GenerateMaterialID(newmat); Assert.That(mat, Is.EqualTo(newmat)); Assert.That(matID, Is.EqualTo(newmatID)); }
public void RenderMaterial_SerializedMaterialsDataGeneratesTheSameMaterialID() { RenderMaterials materials = new RenderMaterials(); RenderMaterial mat = new RenderMaterial(); UUID matID = materials.AddMaterial(mat); byte[] matData = materials.ToBytes(); RenderMaterials newMaterials = RenderMaterials.FromBytes(matData, 0, matData.Length); Assert.That(materials, Is.EqualTo(newMaterials)); Assert.DoesNotThrow(() => { RenderMaterial newmat = newMaterials.GetMaterial(matID); UUID newmatID = RenderMaterial.GenerateMaterialID(newmat); Assert.That(mat, Is.EqualTo(newmat)); Assert.That(matID, Is.EqualTo(newmatID)); }); }