public void Test() { IAggregate target = new Aggregate(); target.Add("A"); target.Add("B"); int i = 0; foreach (string message in target) { i++; } Assert.AreEqual(2, i); }
public void Test() { IAggregate target = new Aggregate(); target.Add("A"); target.Add("B"); IIterator iterator = target.CreateIterator(); Assert.AreEqual <string>("A", iterator.Next()); Assert.AreEqual <string>("B", iterator.Next()); try { iterator.Next(); } catch (Exception exception) { Assert.IsTrue(exception is IndexOutOfRangeException); } }
/// <summary> Add a primitive to the spatial bin and clip it </summary> /// <param name="item">The primitive to clipp and add to the bin</param> public void ClipAndAdd(ISceneObject item) { foreach (ISceneObject singleClipped in ((IDivisible <ISceneObject>)item).Clip(SplitPlaneLeft)) { foreach (ISceneObject doubleClipped in ((IDivisible <ISceneObject>)singleClipped).Clip(SplitPlaneRight)) { Aggregate.Add(doubleClipped); if (doubleClipped is PrimitiveFragment fragment) { Fragments.Add(fragment); } } } }