Ejemplo n.º 1
0
        public void CopyFromTest()
        {
            //create two different weirs
            //the target should copy all the property values form the source
            //into the target, but not the name and geometry!!
            IWeir sourceWeir = new Weir
            {
                Geometry          = new Point(7, 0),
                OffsetY           = 175,
                CrestWidth        = 75,
                CrestLevel        = -3,
                Name              = "Source Weir",
                AllowNegativeFlow = true,
                WeirFormula       = new GatedWeirFormula()
            };
            IWeir targetWeir = new Weir
            {
                Geometry          = new Point(42, 0),
                OffsetY           = 571,
                CrestWidth        = 55,
                CrestLevel        = -1,
                Name              = "Target Weir",
                AllowNegativeFlow = false,
                WeirFormula       = new FreeFormWeirFormula()
            };

            targetWeir.CopyFrom(sourceWeir);

            Assert.AreNotEqual(sourceWeir.Name, targetWeir.Name);
            Assert.AreEqual(sourceWeir.OffsetY, targetWeir.OffsetY);
            Assert.AreEqual(sourceWeir.CrestWidth, targetWeir.CrestWidth);
            Assert.AreEqual(sourceWeir.CrestLevel, targetWeir.CrestLevel);
            Assert.AreEqual(sourceWeir.AllowNegativeFlow, targetWeir.AllowNegativeFlow);
            Assert.AreEqual(sourceWeir.WeirFormula.HasFlowDirection, targetWeir.WeirFormula.HasFlowDirection);
            Assert.AreEqual(sourceWeir.IsGated, targetWeir.IsGated);
        }