public void RollbackTest() { // Arrange DepotManager dm = new DepotManager(6); // Act Random r = new Random(); for (int i = 0; i < 6; i++) { dm.AddClient(new Node(new Location(r.Next(100), r.Next(100)), i)); } dm.DeclareDepot(0); dm.CreateRandomRoutes(); int oldCost = dm.TotalCost(); Movement m = new Movement { Nodes = new[] { dm.Trucks[0].Head.Next }, OriginalTruck = 0 }; Node previous = m.Nodes[0].Previous; dm.Trucks[0].RemoveNode(m.Nodes); dm.Rollback(m.OriginalTruck, previous, m.Nodes); int newCost = dm.TotalCost(); // Assert Assert.AreEqual(oldCost, newCost); }