public static void HasAnnotation_AssertUnknownSymbolException(IIonReader reader) { // $ion_symbol_table::{ imports:[{ name: \"abc\", version: 1, max_id: 1}],symbols: [\"foo\"]}$10::$11::\"value\" reader.MoveNext(); Assert.ThrowsException <UnknownSymbolException>(() => reader.HasAnnotation("California Roll")); }
public static void HasAnnotation_ZeroSymbol(IIonReader reader) { // an int with zero symbol annotation // $0::18 reader.MoveNext(); Assert.ThrowsException <ArgumentNullException>(() => reader.HasAnnotation(null)); }
public static void HasAnnotationFalse_SingleField(IIonReader reader) { // a singlefield structure with annotations // {withannot:years::months::days::hours::minutes::seconds::18} reader.MoveNext(); reader.StepIn(); reader.MoveNext(); Assert.AreEqual(IonType.Int, reader.CurrentType); Assert.AreEqual("withannot", reader.CurrentFieldName); Assert.AreEqual(18, reader.IntValue()); Assert.IsFalse(reader.HasAnnotation("Spam Musubi")); }
private static void CompareHasAnnotations(IIonReader it1, IIonReader it2) { //Skip assertion if annotation is zero symbol if (it1.GetTypeAnnotationSymbols().Any(a => a.Text == null && a.Sid == 0)) { return; } string[] syms_text1 = it1.GetTypeAnnotations(); string[] syms_text2 = it2.GetTypeAnnotations(); Assert.IsTrue(syms_text1.Count() == syms_text2.Count()); for (int index = 0; index < syms_text1.Count(); index++) { Assert.IsTrue(it1.HasAnnotation(syms_text2[index])); Assert.IsTrue(it2.HasAnnotation(syms_text1[index])); } }