Ejemplo n.º 1
0
        public void ChangeComponentNameUpdatesColumnName()
        {
            var name = "qqq";

            networkCoverage.Components[0].Name = name;

            Assert.AreEqual(name, networkCoverageBindingList.ColumnNames[2]);
            Assert.AreEqual(name, networkCoverageBindingList.GetItemProperties(null)[2].Name);
        }
Ejemplo n.º 2
0
        public void WorksWithTimeDependentNetworkCoverage()
        {
            var timeNetworkCoverage = new NetworkCoverage("timedep", true);

            timeNetworkCoverage.Network = network;

            var t1 = new DateTime(2000, 1, 1);
            var t2 = new DateTime(2000, 1, 2);

            timeNetworkCoverage[t1, new NetworkLocation(network.Branches[0], 1)] = 10.0;
            timeNetworkCoverage[t1, new NetworkLocation(network.Branches[1], 2)] = 20.0;
            timeNetworkCoverage[t2, new NetworkLocation(network.Branches[0], 1)] = 30.0;
            timeNetworkCoverage[t2, new NetworkLocation(network.Branches[1], 2)] = 40.0;

            var timeCoverageBindingList = new NetworkCoverageBindingList(timeNetworkCoverage);

            Assert.AreEqual(4, timeCoverageBindingList.ColumnNames.Count());

            //columns shifted
            Assert.AreEqual("Location_Branch", timeCoverageBindingList.GetItemProperties(null)[1].Name);

            var newOffset = 1.5;

            Assert.AreNotEqual(newOffset, timeNetworkCoverage.Locations.Values[0].Chainage);

            timeCoverageBindingList[0][2] = newOffset;

            timeCoverageBindingList[0].EndEdit(); //commit changes

            Assert.AreEqual(newOffset, timeNetworkCoverage.Locations.Values[0].Chainage);

            var gridView = new DataGridView {
                DataSource = timeCoverageBindingList
            };

            WindowsFormsTestHelper.ShowModal(gridView);
        }