Exemplo n.º 1
0
        public void PropertyChangedForTabulatedCrossection()
        // TODO: remove test? It seems to be testing NotifyPropertyChangeAspect
        {
            //TS: CrossSection is no longer sending property changed. It does have a manual property, but this would
            //require some hacking in Culvert to propogate this event through PostSharp. Since this seems only used
            //by the view, for now it has been solved there.

            int callCount = 0;
            //use a default
            var bridge = new Bridge();

            bridge.TabulatedCrossSectionDefinition.SetWithHfswData(new[]
            {
                new HeightFlowStorageWidth(10, 50, 50),
                new HeightFlowStorageWidth(16, 100, 100)
            });

            ((INotifyPropertyChanged)bridge).PropertyChanged += (s, e) =>
            {
                Assert.AreEqual(
                    bridge.TabulatedCrossSectionDefinition.
                    ZWDataTable[0], s);
                Assert.AreEqual("Width", e.PropertyName);
                callCount++;
            };

            CrossSectionDataSet.CrossSectionZWRow CrossSectionZWRow = bridge.TabulatedCrossSectionDefinition.ZWDataTable[0];
            CrossSectionZWRow.Width = 22;

            Assert.AreEqual(1, callCount);
        }
        public void GetTabulatedCrossSectionFromTrapezium()
        {
            var definitionZW            = StandardCrossSectionsFactory.GetTabulatedCrossSectionFromTrapezium(2, 20, 100);
            var crossSectionZWDataTable = definitionZW.ZWDataTable;

            Assert.AreEqual(3, crossSectionZWDataTable.Count);

            CrossSectionDataSet.CrossSectionZWRow bottomRow = crossSectionZWDataTable[0];
            Assert.AreEqual(0, bottomRow.Z);
            Assert.AreEqual(20, bottomRow.Width);
            Assert.AreEqual(0, bottomRow.StorageWidth);

            CrossSectionDataSet.CrossSectionZWRow topRow = crossSectionZWDataTable[1];
            Assert.AreEqual(20, topRow.Z);
            Assert.AreEqual(100, topRow.Width);
            Assert.AreEqual(0, topRow.StorageWidth);

            //there is one more row on top of the top row which closes the trapezium
            CrossSectionDataSet.CrossSectionZWRow closingRow = crossSectionZWDataTable[2];
            Assert.AreEqual(20.000001, closingRow.Z);
            Assert.AreEqual(0, closingRow.Width);
            Assert.AreEqual(0, closingRow.StorageWidth);
        }