public void equalPointsTest() { FeatureEdit fe = FeatureEdit.getInstance(); // equal IPoint point1 = new PointClass() { X = 2.356, Y = 3.34 }; IPoint point2 = new PointClass() { X = 2.356, Y = 3.34 }; double tolerance = 0.0001; bool expected = true; bool actual = fe.equalPoints(point1, point2, tolerance); Assert.AreEqual(expected, actual); // not equal IPoint point3 = new PointClass() { X = 2.345, Y = 1.13 }; IPoint point4 = new PointClass() { X = 1.234, Y = 2.45 }; expected = false; actual = fe.equalPoints(point3, point4, tolerance); Assert.AreEqual(expected, actual); // use equal Z value IPoint point5 = new PointClass() { X = 2.123, Y = 1.323, Z = 134 }; IPoint point6 = new PointClass() { X = 2.123, Y = 1.323, Z = 134 }; expected = true; actual = fe.equalPoints(point5, point6, tolerance); Assert.AreEqual(expected, actual); // use not equal Z value IPoint point7 = new PointClass() { X = 2.123, Y = 1.323, Z = 134 }; IPoint point8 = new PointClass() { X = 2.123, Y = 1.323, Z = 136 }; expected = false; actual = fe.equalPoints(point7, point8, tolerance); Assert.AreEqual(expected, actual); }
public void getWorkspaceFactoryTest() { FeatureEdit target = FeatureEdit.getInstance(); // get shapefile workspace factory string extension = "shp"; IWorkspaceFactory actual = target.getWorkspaceFactory(extension); Assert.IsNotNull(actual); // get mdb workspace factory extension = "mdb"; actual = target.getWorkspaceFactory(extension); Assert.IsNotNull(actual); // get gdb workspace factory extension = "gdb"; actual = target.getWorkspaceFactory(extension); Assert.IsNotNull(actual); // get mdb workspace factory extension = "mdb"; actual = target.getWorkspaceFactory(extension); Assert.IsNotNull(actual); }
public void exportSelectedFeatureToShpTest() { FeatureEdit target = FeatureEdit.getInstance(); IFeatureLayer featureLayer = null; // TODO: 初始化为适当的值 ISelectionSet selectionSet = null; // TODO: 初始化为适当的值 string outName = string.Empty; // TODO: 初始化为适当的值 target.exportSelectedFeatureToShp(featureLayer, selectionSet, outName); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void getFeatureWorkspaceFromFileTest() { FeatureEdit target = FeatureEdit.getInstance(); string filename = TestInitialize.m_testDataPath + "shapefiles\\airports.shp"; string extention = "shp"; IFeatureWorkspace actual; actual = target.getFeatureWorkspaceFromFile(filename, extention); Assert.IsNotNull(actual); }
public void getFeatureValueTest() { FeatureEdit target = FeatureEdit.getInstance(); IFeatureClass featureClass = m_featureWorkspace.OpenFeatureClass("airports"); IFeature feature = featureClass.GetFeature(0); string fieldName = "NAME"; object expected = "NOATAK"; object actual = target.getFeatureValue(feature, fieldName); Assert.AreEqual(expected, actual); }
public void setFeatureBufferValueTest() { FeatureEdit target = FeatureEdit.getInstance(); // TODO: 初始化为适当的值 IFeatureBuffer feaBuf = null; // TODO: 初始化为适当的值 string fieldName = string.Empty; // TODO: 初始化为适当的值 object value = null; // TODO: 初始化为适当的值 bool expected = false; // TODO: 初始化为适当的值 bool actual; actual = target.setFeatureBufferValue(feaBuf, fieldName, value); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public void setFeatureValueTest() { FeatureEdit target = FeatureEdit.getInstance(); IFeatureClass featureClass = m_featureWorkspace.OpenFeatureClass("airports"); IFeature feature = featureClass.GetFeature(0); string fieldName = string.Empty; object value = null; bool save = false; bool expected = false; bool actual; actual = target.setFeatureValue(feature, fieldName, value, save); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public void equalFeatureTest() { FeatureEdit fe = FeatureEdit.getInstance(); IFeatureClass featureClass = m_featureWorkspace.OpenFeatureClass("airports"); IFeature f1 = featureClass.GetFeature(0); IFeature f2 = featureClass.CreateFeature(); f2.Shape = f1.ShapeCopy; for (int i = 1; i < f1.Fields.FieldCount; i++) { f2.set_Value(i, f1.get_Value(i)); } Assert.IsTrue(fe.equalFeature(f1, f2)); // 最后删除掉这个新建的测试要素 f2.Delete(); }
public void equalGeometryTest() { FeatureEdit fe = FeatureEdit.getInstance(); // 测试两个相同的几何对象 IGeometry geo1 = new PolylineClass(); IPointCollection pc1 = geo1 as IPointCollection; pc1.AddPoint(new PointClass() { X = 1.2, Y = 2.3 }); pc1.AddPoint(new PointClass() { X = 1.4, Y = 2.5 }); pc1.AddPoint(new PointClass() { X = 1.1, Y = 2.8 }); IGeometry geo2 = new PolylineClass(); IPointCollection pc2 = geo2 as IPointCollection; pc2.AddPoint(new PointClass() { X = 1.2, Y = 2.3 }); pc2.AddPoint(new PointClass() { X = 1.4, Y = 2.5 }); pc2.AddPoint(new PointClass() { X = 1.1, Y = 2.8 }); bool actual = fe.equalGeometry(geo1, geo2); Assert.IsTrue(actual); // 测试两个不同的几何对象 IGeometry geo3 = new PolylineClass(); IPointCollection pc3 = geo3 as IPointCollection; pc3.AddPoint(new PointClass() { X = 1.1, Y = 2.8 }); pc3.AddPoint(new PointClass() { X = 1.4, Y = 2.5 }); pc3.AddPoint(new PointClass() { X = 1.1, Y = 2.8 }); actual = fe.equalGeometry(geo1, geo3); Assert.IsFalse(actual); }
public void getFeatureEditInstanceTest() { FeatureEdit fe = FeatureEdit.getInstance(); Assert.IsNotNull(fe); }