コード例 #1
0
        public void CloneNetworkCoverage()
        {
            var network = CreateNetwork();

            INetworkCoverage networkCoverage = new NetworkCoverage {
                Network = network
            };

            // set values
            networkCoverage[new NetworkLocation(network.Branches[0], 0.0)]   = 0.1;
            networkCoverage[new NetworkLocation(network.Branches[0], 100.0)] = 0.2;
            networkCoverage[new NetworkLocation(network.Branches[1], 0.0)]   = 0.3;
            networkCoverage[new NetworkLocation(network.Branches[1], 50.0)]  = 0.4;
            networkCoverage[new NetworkLocation(network.Branches[1], 200.0)] = 0.5;

            INetworkCoverage clone = (INetworkCoverage)networkCoverage.Clone();

            Assert.AreEqual(5, clone.Locations.Values.Count);
            Assert.AreNotSame(clone.Locations.Values[0], networkCoverage.Locations.Values[0]);
        }
コード例 #2
0
        public void CloneNetworkCoverage()
        {
            var network = CreateNetwork();

            INetworkCoverage networkCoverage = new NetworkCoverage { Network = network };

            // set values
            networkCoverage[new NetworkLocation(network.Branches[0], 0.0)] = 0.1;
            networkCoverage[new NetworkLocation(network.Branches[0], 100.0)] = 0.2;
            networkCoverage[new NetworkLocation(network.Branches[1], 0.0)] = 0.3;
            networkCoverage[new NetworkLocation(network.Branches[1], 50.0)] = 0.4;
            networkCoverage[new NetworkLocation(network.Branches[1], 200.0)] = 0.5;

            networkCoverage.Locations.Unit = new Unit("networklocation","b/o");

            INetworkCoverage clone = (INetworkCoverage)networkCoverage.Clone();
            Assert.AreEqual(5, clone.Locations.Values.Count);
            Assert.AreNotSame(clone.Locations.Values[0], networkCoverage.Locations.Values[0]);

            Assert.AreNotSame(networkCoverage.Locations.Unit,clone.Locations.Unit);
            Assert.AreEqual(networkCoverage.Locations.Unit.Name, clone.Locations.Unit.Name);
        }
コード例 #3
0
        public void CloneNetworkCoverageWithTwoComponents()
        {
            var network = RouteHelperTest.GetSnakeNetwork(false, new Point(0, 0), new Point(100, 0), new Point(100, 100));
            var f = new NetworkCoverage { Network = network };
            f.Components.Add(new Variable<string>("s"));
            var firstBranch = network.Branches[0];
            f[new NetworkLocation(firstBranch, 50)] = new object[] { 2.0, "test" };

            var fClone = f.Clone();
            Assert.AreEqual(f.Components[0].Values[0], ((Function)fClone).Components[0].Values[0]);
            Assert.AreEqual(f.Components[1].Values[0], ((Function)fClone).Components[1].Values[0]);
        }