public void TestImplyIndicies() { TypeMetadataBuilder <PoffedImpliedIndicies> builder = new TypeMetadataBuilder <PoffedImpliedIndicies>(); IVisitor <TypeMetadataBuilder <PoffedImpliedIndicies> > visitor = new AnnotationVisitor <TypeMetadataBuilder <PoffedImpliedIndicies>, PoffedImpliedIndicies>(true); builder.SetTypeId(1002); builder.Accept(visitor, typeof(PoffedImpliedIndicies)); ITypeMetadata <PoffedImpliedIndicies> tmd = builder.Build(); Assert.AreEqual(1002, tmd.Key.TypeId); Assert.AreEqual(2, tmd.GetAttribute("lastName").Index); Assert.AreEqual(1, tmd.GetAttribute("firstName").Index); Assert.AreEqual(0, tmd.GetAttribute("age").Index); }
public void TestVisit() { TypeMetadataBuilder <Poffed> builder = new TypeMetadataBuilder <Poffed>(); IVisitor <TypeMetadataBuilder <Poffed> > visitor = new AnnotationVisitor <TypeMetadataBuilder <Poffed>, Poffed>(); builder.SetTypeId(1001); builder.Accept(visitor, typeof(Poffed)); ITypeMetadata <Poffed> tmd = builder.Build(); Assert.AreEqual(1001, tmd.Key.TypeId); Assert.AreEqual(0, tmd.GetAttribute("lastName").Index); Assert.AreEqual(1, tmd.GetAttribute("age").Index); Assert.AreEqual(2, tmd.GetAttribute("firstName").Index); }
public void TestAccessorAnnotations() { TypeMetadataBuilder <PoffedMethodInspection> builder = new TypeMetadataBuilder <PoffedMethodInspection>(); IVisitor <TypeMetadataBuilder <PoffedMethodInspection> > visitor = new AnnotationVisitor <TypeMetadataBuilder <PoffedMethodInspection>, PoffedMethodInspection>(true); builder.SetTypeId(1005); builder.Accept(visitor, typeof(PoffedMethodInspection)); ITypeMetadata <PoffedMethodInspection> tmd = builder.Build(); Assert.AreEqual(1005, tmd.Key.TypeId); Assert.AreEqual(0, tmd.GetAttribute("adult").Index); Assert.AreEqual(1, tmd.GetAttribute("age").Index); Assert.AreEqual(2, tmd.GetAttribute("firstName").Index); Assert.AreEqual(3, tmd.GetAttribute("lastName").Index); }
public void TestCustomCodec() { TypeMetadataBuilder <PoffedCustomCodec> builder = new TypeMetadataBuilder <PoffedCustomCodec>(); IVisitor <TypeMetadataBuilder <PoffedCustomCodec> > visitor = new AnnotationVisitor <TypeMetadataBuilder <PoffedCustomCodec>, PoffedCustomCodec>(true); builder.SetTypeId(1004); builder.Accept(visitor, typeof(PoffedCustomCodec)); ITypeMetadata <PoffedCustomCodec> tmd = builder.Build(); Assert.AreEqual(1004, tmd.Key.TypeId); Assert.AreEqual(0, tmd.GetAttribute("age").Index); Assert.AreEqual(1, tmd.GetAttribute("aliases").Index); Assert.AreEqual(2, tmd.GetAttribute("firstName").Index); Assert.AreEqual(3, tmd.GetAttribute("lastName").Index); Assert.IsInstanceOf(typeof(LinkedListCodec <string>), tmd.GetAttribute("aliases").Codec); }