示例#1
0
        public static void AsyncMethodBuilderAttributeTests()
        {
            var attr1 = new AsyncMethodBuilderAttribute(null);

            Assert.Null(attr1.BuilderType);

            var attr2 = new AsyncMethodBuilderAttribute(typeof(AttributesTests));

            Assert.Equal(typeof(AttributesTests), attr2.BuilderType);
        }
示例#2
0
        public void AsyncMethodBuilderAttribute_ValueTaskAttributed(Type valueTaskType)
        {
            CustomAttributeData cad = valueTaskType.GetTypeInfo().CustomAttributes.Single(attr => attr.AttributeType == typeof(AsyncMethodBuilderAttribute));
            Type builderTypeCtorArg = (Type)cad.ConstructorArguments[0].Value;

            Assert.Equal(typeof(AsyncValueTaskMethodBuilder <>), builderTypeCtorArg);

            AsyncMethodBuilderAttribute amba = valueTaskType.GetTypeInfo().GetCustomAttribute <AsyncMethodBuilderAttribute>();

            Assert.Equal(builderTypeCtorArg, amba.BuilderType);
        }
示例#3
0
        public void Ctor_BuilderType_Roundtrip(Type builderType)
        {
            var amba = new AsyncMethodBuilderAttribute(builderType);

            Assert.Same(builderType, amba.BuilderType);
        }
 public void Ctor_BuilderType_Roundtrip(Type builderType)
 {
     var amba = new AsyncMethodBuilderAttribute(builderType);
     Assert.Same(builderType, amba.BuilderType);
 }