Exemple #1
0
        public void ByElevationAndName_ShouldProduceLevelAtCorrectElevation()
        {
            // construct the extrusion
            var elevation = 100.0;
            var name      = "Ham";
            var level     = Level.ByElevationAndName(elevation, name);

            Assert.NotNull(level);

            level.Elevation.ShouldBeApproximately(elevation);
            level.ProjectElevation.ShouldBeApproximately(elevation);

            Assert.AreEqual(name, level.Name);

            // without unit conversion
            InternalElevation(level)
            .ShouldBeApproximately(elevation * UnitConverter.DynamoToHostFactor(UnitType.UT_Length));
        }
Exemple #2
0
        public void ByElevationAndName_DuplicatedNames()
        {
            //Create a new level with the name of "Ham" and the
            //elevation of 100
            var elevation = 100.0;
            var name      = "Old Level";
            var level     = Level.ByElevationAndName(elevation, name);

            Assert.NotNull(level);

            level.Elevation.ShouldBeApproximately(elevation);
            Assert.AreEqual(name, level.Name);

            //Create a new level with the same name and elevation
            level = Level.ByElevationAndName(elevation, name);

            level.Elevation.ShouldBeApproximately(elevation);
            Assert.AreEqual(name + "(1)", level.Name);

            //Once again create a new level with the same name and elevation
            level = Level.ByElevationAndName(elevation, name);

            level.Elevation.ShouldBeApproximately(elevation);
            Assert.AreEqual(name + "(2)", level.Name);

            //Create a new level with a name of lowercase letters
            //and the same elevation
            var name3  = "old level";
            var level3 = Level.ByElevationAndName(elevation, name3);

            Assert.IsNotNull(level3);

            level3.Elevation.ShouldBeApproximately(elevation);
            Assert.AreEqual(name3, level3.Name);

            //Create a new level with a totally different name
            var name4  = "New level";
            var level4 = Level.ByElevationAndName(elevation, name4);

            Assert.NotNull(level4);

            level4.Elevation.ShouldBeApproximately(elevation);
            Assert.AreEqual(name4, level4.Name);
        }
Exemple #3
0
        public void ByElevationAndName_NullArgument()
        {
            var elevation = 100;

            Assert.Throws(typeof(ArgumentNullException), () => Level.ByElevationAndName(elevation, null));
        }