public void Links_EnsureScopedLinkByNameWorks() { ModelWithScopedLinkByName modelWithScopedLink = new UnitTests.ModelWithScopedLinkByName(); // Create a simulation ModelWrapper simulation = new ModelWrapper(new Simulation()); simulation.Add(new Clock()); simulation.Add(new MockSummary()); simulation.Add(new Zone() { Name = "zone1" }); simulation.Add(new Zone() { Name = "zone2" }); simulation.Children[1].Add(modelWithScopedLink); // added to zone1 Links linksAlgorithm = new Links(); linksAlgorithm.Resolve(simulation); Assert.AreEqual(modelWithScopedLink.zone2.Name, "zone2"); }
public void Links_EnsureScopedLinkByNameWorks() { ModelWithScopedLinkByName modelWithScopedLink = new UnitTests.ModelWithScopedLinkByName(); // Create a simulation ModelWrapper simulation = new ModelWrapper(new Simulation()); simulation.Add(new Clock()); simulation.Add(new MockSummary()); simulation.Add(new Zone() { Name = "zone1" }); simulation.Add(new Zone() { Name = "zone2" }); simulation.Children[1].Add(modelWithScopedLink); // added to zone1 Links linksAlgorithm = new Links(); linksAlgorithm.Resolve(simulation); Assert.AreEqual(modelWithScopedLink.zone2.Name, "zone2"); }