public void LocatorGetVariableWithAbsoluteAddress() { Simulation sim = new Simulation(); sim.Children.Add(new ModelA()); sim.Children.Add(new ModelB()); sim.Children.Add(new Zone()); sim.Children[2].Children.Add(new ModelC()); sim.Children[2].Children.Add(new ModelD()); Simulations sims = Simulations.Create(new Model[] { sim }); // locator for modelC ILocator locatorForC = sims.GetLocatorService(sim.Children[2].Children[0]); Assert.AreEqual(locatorForC.Get(".Simulations.Simulation.ModelA.A1"), 1); // locator for modelD ILocator locatorForD = sims.GetLocatorService(sim.Children[2].Children[1]); Assert.AreEqual(locatorForD.Get(".Simulations.Simulation.Zone.ModelD.D2.Year"), 2000); }
public void LocatorGetModel() { Simulation sim = new Simulation(); sim.Children.Add(new ModelA()); sim.Children.Add(new ModelB()); sim.Children.Add(new Zone()); sim.Children[2].Children.Add(new ModelC()); sim.Children[2].Children.Add(new ModelD()); Simulations sims = Simulations.Create(new Model[] { sim }); // locator for modelC ILocator locatorForC = sims.GetLocatorService(sim.Children[2].Children[0]); Assert.AreEqual(locatorForC.Get("[ModelA]"), sim.Children[0]); }
public void LocatorGetVariableWithRelativeAddress() { Simulation sim = new Simulation(); sim.Children.Add(new ModelA()); sim.Children.Add(new ModelB()); sim.Children.Add(new Zone()); sim.Children[2].Children.Add(new ModelC()); sim.Children[2].Children.Add(new ModelD()); Simulations sims = Simulations.Create(new Model[] { sim }); // locator for zone ILocator locatorForZone = sims.GetLocatorService(sim.Children[2]); Assert.AreEqual(locatorForZone.Get("ModelC.C1"), 5); }
public void LocatorGetVariableWithArrayIndex() { Simulation sim = new Simulation(); sim.Children.Add(new ModelA()); sim.Children.Add(new ModelB()); sim.Children.Add(new Zone()); sim.Children[2].Children.Add(new ModelC()); sim.Children[2].Children.Add(new ModelD()); Simulations sims = Simulations.Create(new Model[] { sim }); // locator for modelD ILocator locatorForD = sims.GetLocatorService(sim.Children[2].Children[1]); Assert.AreEqual(locatorForD.Get("[ModelC].C2[1]"), 6.0); Assert.AreEqual(locatorForD.Get("[ModelC].C2[2]"), 6.1); Assert.AreEqual(locatorForD.Get("[ModelC].C2[3]"), 6.2); }
public void TestPropertyOfInterface() { Concrete2 c2 = new Concrete2(); Concrete3 c3 = new Concrete3(); Container container = new Container(); Simulation sim = new Simulation(); sim.Children.Add(container); Simulations sims = new Simulations(); sims.Children.Add(sim); ILocator locator = sims.GetLocatorService(sim); container.Value = c2; Assert.AreEqual(2, locator.Get("[Container].Value.X")); container.Value = c3; Assert.AreEqual(3, locator.Get("[Container].Value.X")); }
public void LocatorGetPropertyOfModelAtSpecificArrayElement() { Simulation sim = new Simulation(); sim.Children.Add(new ModelF()); sim.Children.Add(new ModelB()); sim.Children.Add(new Zone()); sim.Children[2].Children.Add(new ModelC()); ModelE e = new ModelE(); e.models[0].F = 20; e.models[1].F = 21; sim.Children[2].Children.Add(e); Simulations sims = Simulations.Create(new Model[] { sim }); // locator for modelC ILocator locatorForC = sims.GetLocatorService(sim.Children[2].Children[0]); Assert.AreEqual(locatorForC.Get("[ModelE].E1[1].F"), 20); Assert.AreEqual(locatorForC.Get("[ModelE].E1[2].F"), 21); }