public void CreatePrismWithFactory() { Prism c = new Prism(10, (a, b) => new VertexTest(a, b), new Vector2[] { new Vector2(-1, 1), new Vector2(1, 1), new Vector2(0, 0), }); Assert.IsTrue(c.Polygons.SelectMany(a => a.Vertices).All(a => a is VertexTest)); }
public void MeasurePrismBounds() { Prism c = new Prism(1, new Vector2[] { new Vector2(-1, 1), new Vector2(1, 1), new Vector2(0, 0), }); foreach (var v in c.Polygons.SelectMany(a => a.Vertices)) { Debug.Assert(c.Bounds != null, "c.Bounds != null"); Assert.IsTrue(c.Bounds.Value.Contains(v.Position) != ContainmentType.Disjoint); } }
public void PrismDescription() { Prism c = new Prism(3, new Vector2[] { new Vector2(-1, 17), new Vector2(3, 2), new Vector2(0, 10), }); Assert.AreEqual(10, c.Description.Count()); Assert.AreEqual("prism", c.Description.First()); Assert.AreEqual((float)3, c.Description.Skip(1).First()); Assert.AreEqual((uint)3, c.Description.Skip(2).First()); Assert.AreEqual((float)-1, c.Description.Skip(3).First()); Assert.AreEqual((float)17, c.Description.Skip(4).First()); Assert.AreEqual((float)3, c.Description.Skip(5).First()); Assert.AreEqual((float)2, c.Description.Skip(6).First()); Assert.AreEqual((float)0, c.Description.Skip(7).First()); Assert.AreEqual((float)10, c.Description.Skip(8).First()); }