[AssertTraffic(AllocatedSizeInBytes = 2 * Mb)] // --assert public void WholeRunTraffic() { // --act var target = new PetriDish(160, 100, timer); for (var i = 0; i < 100; i++) { target.PerformOneStep(); } }
public void DontRecreateArrays() { // --arrange var target = new PetriDish(160, 100, timer); var memoryPoint1 = dotMemory.Check(); // --act target.PerformOneStep(); // --assert dotMemory.Check(memory => Assert.That(memory.GetDifference(memoryPoint1) .GetNewObjects(where => where.Type.Is <Cell[, ]>()) .ObjectsCount, Is.EqualTo(0))); }
public void AlgorithmTraffic() { // --arrange var target = new PetriDish(160, 100, timer); var memoryPoint1 = dotMemory.Check(); // --act for (var i = 0; i < 100; i++) { target.PerformOneStep(); } // --assert dotMemory.Check(memory => Assert.That(memory.GetTrafficFrom(memoryPoint1) .AllocatedMemory .ObjectsCount, Is.LessThan(100))); }