public void HasFieldMarshal() { Assert.Equal(0, CodedIndex.HasFieldMarshal(default(FieldDefinitionHandle))); Assert.Equal((0xffffff << 1) | 1, CodedIndex.HasFieldMarshal(MetadataTokens.ParameterHandle(0xffffff))); Assert.Equal(0x02 | 0, CodedIndex.HasFieldMarshal(MetadataTokens.FieldDefinitionHandle(1))); Assert.Equal(0x02 | 1, CodedIndex.HasFieldMarshal(MetadataTokens.ParameterHandle(1))); }
public void Errors() { var badHandleKind = CustomAttributeHandle.FromRowId(1); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.HasCustomAttribute(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.HasConstant(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.CustomAttributeType(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.HasDeclSecurity(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.HasFieldMarshal(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.HasSemantics(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.Implementation(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.MemberForwarded(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.MemberRefParent(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.MethodDefOrRef(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.ResolutionScope(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.TypeDefOrRef(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.TypeDefOrRefOrSpec(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.TypeOrMethodDef(badHandleKind)); AssertExtensions.Throws <ArgumentException>(null, () => CodedIndex.HasCustomDebugInformation(badHandleKind)); }