示例#1
0
        public void Constructor_ValidData_ExpectedValues()
        {
            // Setup
            var          location = new Point2D(1.22, 2.333);
            const double structureNormalOrientation = 0.0;

            // Call
            var structure = new TestStructureBase(new StructureBase.ConstructionProperties
            {
                Name     = "aName",
                Id       = "anId",
                Location = location,
                StructureNormalOrientation = (RoundedDouble)structureNormalOrientation
            });

            // Assert
            Assert.IsInstanceOf <Observable>(structure);

            Assert.AreEqual("aName", structure.Name);
            Assert.AreEqual("anId", structure.Id);
            Assert.AreEqual(location.X, structure.Location.X);
            Assert.AreEqual(location.Y, structure.Location.Y);
            Assert.AreEqual("aName", structure.ToString());
            Assert.AreEqual(2, structure.StructureNormalOrientation.NumberOfDecimalPlaces);
            Assert.AreEqual(structureNormalOrientation, structure.StructureNormalOrientation,
                            structure.StructureNormalOrientation.GetAccuracy());
        }
示例#2
0
        public void CopyProperties_FromStructure_UpdatesProperties()
        {
            // Setup
            var structure = new TestStructureBase(new StructureBase.ConstructionProperties
            {
                Name     = "aName",
                Id       = "anId",
                Location = new Point2D(0, 0),
                StructureNormalOrientation = RoundedDouble.NaN
            });

            var otherStructure = new TestStructureBase(new StructureBase.ConstructionProperties
            {
                Name     = "otherName",
                Id       = "otherId",
                Location = new Point2D(1, 1),
                StructureNormalOrientation = (RoundedDouble)89
            });

            // Call
            structure.CopyProperties(otherStructure);

            // Assert
            Assert.AreNotEqual(otherStructure.Id, structure.Id);
            Assert.AreEqual(otherStructure.Name, structure.Name);
            TestHelper.AssertAreEqualButNotSame(otherStructure.Location, structure.Location);
            Assert.AreEqual(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation);
        }
示例#3
0
        public void CopyProperties_FromStructureNull_ThrowsArgumentNullException()
        {
            // Setup
            var structure = new TestStructureBase(new StructureBase.ConstructionProperties
            {
                Name     = "aName",
                Id       = "anId",
                Location = new Point2D(0, 0)
            });

            // Call
            TestDelegate call = () => structure.CopyProperties(null);

            // Assert
            string paramName = Assert.Throws <ArgumentNullException>(call).ParamName;

            Assert.AreEqual("fromStructure", paramName);
        }
示例#4
0
        public void Constructor_DefaultValues_ExpectedValues()
        {
            // Setup
            var location = new Point2D(1.22, 2.333);

            // Call
            var structure = new TestStructureBase(new StructureBase.ConstructionProperties
            {
                Name     = "aName",
                Id       = "anId",
                Location = location
            });

            // Assert
            Assert.AreEqual("aName", structure.Name);
            Assert.AreEqual("anId", structure.Id);
            Assert.AreEqual(location.X, structure.Location.X);
            Assert.AreEqual(location.Y, structure.Location.Y);
            Assert.AreEqual("aName", structure.ToString());
            Assert.AreEqual(2, structure.StructureNormalOrientation.NumberOfDecimalPlaces);
            Assert.IsNaN(structure.StructureNormalOrientation);
        }
示例#5
0
 public void CopyProperties(TestStructureBase fromStructureBase)
 {
     base.CopyProperties(fromStructureBase);
 }