Exemple #1
0
        public void EqualsTest2()//LayerName不同,FeatureAttribute为空等测试
        {
            Point3D testPoint1 = new Point3D {
                X = 0, Y = 0, Z = 0
            };
            Point3D testPoint2 = new Point3D {
                X = 0, Y = 0, Z = 0
            };

            FeatureObject featureObject = new FeatureObject()
            {
                Coordinates = new List <Point3D>()
                {
                    testPoint1
                }, LayerName = "test1", FeatureAttribute = null
            };
            FeatureObject featureObjectCompare = new FeatureObject()
            {
                Coordinates = new List <Point3D>()
                {
                    testPoint2
                }, LayerName = null, FeatureAttribute = null
            };

            var result = featureObject.Equals(featureObjectCompare);

            Assert.AreEqual(result, false);
        }
Exemple #2
0
        public void EqualsTest5()//完全相同测试
        {
            DataTable table = new DataTable();

            table.Columns.Add("column1");
            table.Columns.Add("column2");
            DataRow row = table.NewRow();

            row[0] = 111;
            row[1] = 222;
            table.Rows.Add(row);

            Point3D testPoint1 = new Point3D {
                X = 0, Y = 0, Z = 0
            };

            FeatureObject featureObject = new FeatureObject()
            {
                Coordinates = new List <Point3D>()
                {
                    testPoint1
                }, LayerName = "test1", FeatureAttribute = row
            };
            FeatureObject featureObjectCompare = new FeatureObject()
            {
                Coordinates = new List <Point3D>()
                {
                    testPoint1
                }, LayerName = "test1", FeatureAttribute = row
            };

            var result = featureObject.Equals(featureObjectCompare);

            Assert.AreEqual(result, true);
        }
Exemple #3
0
        public void DeepCloneTest()//深拷贝测试
        {
            DataTable table = new DataTable();

            table.Columns.Add("column1");
            table.Columns.Add("column2");
            DataRow row = table.NewRow();

            row[0] = 111;
            row[1] = 222;
            table.Rows.Add(row);
            Point3D testPoint1 = new Point3D {
                X = 0, Y = 0, Z = 0
            };
            FeatureObject featureObject = new FeatureObject()
            {
                Coordinates = new List <Point3D>()
                {
                    testPoint1
                }, LayerName = "test1", FeatureAttribute = row
            };

            var obj = featureObject.Clone();

            Assert.AreNotEqual(featureObject.GetHashCode(), obj.GetHashCode());

            var result = featureObject.Equals(obj);

            Assert.AreEqual(result, true);
        }
Exemple #4
0
        public void EqualsTest()
        {
            FeatureObject featureObject = new FeatureObject()
            {
                Coordinates = null
            };
            FeatureObject featureObjectCompare = new FeatureObject()
            {
                Coordinates = null
            };

            //类型不匹配测试
            var result1 = featureObject.Equals("");

            Assert.AreEqual(result1, false);

            //Coordinates相等且为null测试
            var result2 = featureObject.Equals(featureObjectCompare);

            Assert.AreEqual(result2, true);
        }