public void TestXmlFeatureNullValues() { //Simulate post-#708 SELECTFEATURES and verify reader properly handles null values in response var bytes = Encoding.UTF8.GetBytes(Properties.Resources.SelectFeatureSample); var reader = new XmlFeatureReader(new MemoryStream(bytes)); Assert.AreEqual(3, reader.FieldCount); reader.ReadNext(); Assert.IsFalse(reader.IsNull(0)); Assert.IsFalse(reader.IsNull(1)); Assert.IsFalse(reader.IsNull(2)); reader.ReadNext(); Assert.IsFalse(reader.IsNull(0)); Assert.IsFalse(reader.IsNull(1)); Assert.IsTrue(reader.IsNull(2)); reader.ReadNext(); Assert.IsFalse(reader.IsNull(0)); Assert.IsTrue(reader.IsNull(1)); Assert.IsTrue(reader.IsNull(2)); Assert.IsFalse(reader.ReadNext()); //end of stream //Test the IEnumerable approach reader = new XmlFeatureReader(new MemoryStream(bytes)); int i = 0; foreach (var feat in reader) { switch (i) { case 0: Assert.IsFalse(feat.IsNull(0)); Assert.IsFalse(feat.IsNull(1)); Assert.IsFalse(feat.IsNull(2)); break; case 1: Assert.IsFalse(feat.IsNull(0)); Assert.IsFalse(feat.IsNull(1)); Assert.IsTrue(feat.IsNull(2)); break; case 2: Assert.IsFalse(feat.IsNull(0)); Assert.IsTrue(feat.IsNull(1)); Assert.IsTrue(feat.IsNull(2)); break; } i++; } }
public void TestXmlFeatureJoinValues() { var bytes = Encoding.UTF8.GetBytes(Properties.Resources.FeatureJoinSelectSample); var reader = new XmlFeatureReader(new MemoryStream(bytes)); Assert.AreEqual(40, reader.FieldCount); int count = 0; while (reader.ReadNext()) { count++; } Assert.AreEqual(63, count); }