当前位置: 首页>>代码示例>>C#>>正文


C# MethodData类代码示例

本文整理汇总了C#中MethodData的典型用法代码示例。如果您正苦于以下问题:C# MethodData类的具体用法?C# MethodData怎么用?C# MethodData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MethodData类属于命名空间,在下文中一共展示了MethodData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArgumentNullException

        /// <summary>
        /// Sets up an errored execute setup.
        /// </summary>
        /// <param name="methodData">The method data.</param>
        /// <returns>A <see cref="Func{T}"/> returning an errored <see cref="Task"/> setup with the <see cref="Exception"/>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="methodData"/> parameter is <see langword="null"/>.</exception>
        Func<Task> IExecutionSetup.Setup(MethodData methodData)
        {
            if (methodData == null)
                throw new ArgumentNullException("methodData");

            return Execute;
        }
开发者ID:AutoTestNET,项目名称:AutoTest.ArgumentNullException,代码行数:13,代码来源:ErroredExecutionSetup.cs

示例2: StateContext

 public StateContext(string jobId, MethodData methodData)
 {
     if (String.IsNullOrEmpty(jobId)) throw new ArgumentNullException("jobId");
     
     JobId = jobId;
     MethodData = methodData;
 }
开发者ID:hahmed,项目名称:HangFire,代码行数:7,代码来源:StateContext.cs

示例3: GetBaseAndImplementedMethods

        public static IEnumerable<MethodData> GetBaseAndImplementedMethods(MethodData method)
        {
            if (!(method.Inner is MethodInfo)) // constructor
                return Enumerable.Empty<MethodData>();

            return Inheritance.GetBaseAndImplementedMethodsForMethod(method);
        }
开发者ID:ashmind,项目名称:ashmind-code,代码行数:7,代码来源:Inheritance.cs

示例4: ToCode_given_ConstructorDataWithoutParameters_should_ReturnDefaultConstructorCode

        public void ToCode_given_ConstructorDataWithoutParameters_should_ReturnDefaultConstructorCode()
        {
            //	#	Arrange.
            var sut = new MethodData();
            sut.Comment = new CommentData("Default constructor.");
            sut.IsConstructor = true;
            sut.Scope = Common.VisibilityScope.Public;
            sut.Name = "MyClassName";

            //	#	Act.
            var res = sut.ToCode();

            //	#	Assert.
            Assert.AreEqual(5, res.Count);
            CollectionAssert.AreEqual(
                new[]
                {
                    "/// <summary> Default constructor.",
                    "/// </summary>",
                    "public MyClassName()",
                    "{",
                    "}",
                },
                res.ToList());
        }
开发者ID:LosManos,项目名称:St4mpede,代码行数:25,代码来源:MethodDataTest.cs

示例5: GetBaseAndImplementedMethodsForMethod

        private static IEnumerable<MethodData> GetBaseAndImplementedMethodsForMethod(MethodData method)
        {
            var bases = Inheritance.GetBaseMethods(method);
            var implements = Inheritance.GetImplementedMethods(method);

            return Enumerable.Concat(bases, implements);
        }
开发者ID:ashmind,项目名称:ashmind-code,代码行数:7,代码来源:Inheritance.cs

示例6: JobType

        public static string JobType(MethodData methodData)
        {
            if (methodData == null)
            {
                return "Could not find the target method.";
            }

            return methodData.Type.FullName;
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:9,代码来源:HtmlHelper.cs

示例7: DisplayMethod

        public static string DisplayMethod(MethodData methodData)
        {
            if (methodData == null)
            {
                return null;
            }

            var separator = methodData.MethodInfo.IsStatic ? "." : "::";
            return String.Format("{0}{1}{2}", methodData.Type.Name, separator, methodData.MethodInfo.Name);
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:10,代码来源:HtmlHelper.cs

示例8: Ctor_CorrectlySets_PropertyValues

        public void Ctor_CorrectlySets_PropertyValues()
        {
            var type = typeof (TestJob);
            var methodInfo = type.GetMethod("Perform");
            var method = new MethodData(type, methodInfo);

            Assert.Equal(type, method.Type);
            Assert.Equal(methodInfo, method.MethodInfo);
            Assert.False(method.OldFormat);
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:10,代码来源:MethodDataFacts.cs

示例9: JobAsMethodPerformStrategy

        public JobAsMethodPerformStrategy(
            MethodData methodData,
            string[] arguments)
        {
            if (methodData == null) throw new ArgumentNullException("methodData");
            if (arguments == null) throw new ArgumentNullException("arguments");

            _methodData = methodData;
            _arguments = arguments;
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:10,代码来源:JobAsMethodPerformStrategy.cs

示例10: GetFilters

        public virtual IEnumerable<JobFilter> GetFilters(MethodData methodData)
        {
            var typeFilters = GetTypeAttributes(methodData)
                .Select(attr => new JobFilter(attr, JobFilterScope.Type, null));

            var methodFilters = GetMethodAttributes(methodData)
                .Select(attr => new JobFilter(attr, JobFilterScope.Method, null));

            return typeFilters.Union(methodFilters).ToList();
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:10,代码来源:JobFilterAttributeFilterProvider.cs

示例11: JobAsClassPerformStrategy

        public JobAsClassPerformStrategy(
            MethodData methodData,
            Dictionary<string, string> arguments)
        {
            if (methodData == null) throw new ArgumentNullException("methodData");
            if (arguments == null) throw new ArgumentNullException("arguments");

            _methodData = methodData;
            _arguments = arguments;
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:10,代码来源:JobAsClassPerformStrategy.cs

示例12: ApplyStateContextFacts

        public ApplyStateContextFacts()
        {
            _methodData = MethodData.FromExpression(() => Console.WriteLine());
            _newStateMock = new Mock<State>();
            _newStateMock.Setup(x => x.Name).Returns(NewState);

            _transaction = new Mock<IWriteOnlyTransaction>();
            
            _filters = new List<IApplyStateFilter>();
            _handlers = new StateHandlerCollection();
        }
开发者ID:hahmed,项目名称:HangFire,代码行数:11,代码来源:ApplyStateContextFacts.cs

示例13: GetImplementedMethods

        public static IEnumerable<MethodData> GetImplementedMethods(MethodData method)
        {
            var type = method.DeclaringType;
            if (type.Inner.IsInterface)
                return Enumerable.Empty<MethodData>();

            return from implementation in type.ImplementedInterfaces
                   from map in implementation.Members.AsEnumerable()
                   where map.Value == method
                   select (MethodData)map.Key;
        }
开发者ID:ashmind,项目名称:ashmind-code,代码行数:11,代码来源:Inheritance.cs

示例14: ArgumentNullException

        /// <summary>
        /// Sets up a reflected asynchronous <see cref="MethodBase"/> execution.
        /// </summary>
        /// <param name="methodData">The method data.</param>
        /// <returns>A reflected asynchronous <see cref="MethodBase"/> execution.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="methodData"/> parameter is <see langword="null"/>.</exception>
        Func<Task> IExecutionSetup.Setup(MethodData methodData)
        {
            if (methodData == null)
                throw new ArgumentNullException("methodData");

            _methodUnderTest = methodData.MethodUnderTest;
            _parameters = methodData.Parameters;
            _sut = methodData.InstanceUnderTest;

            return Execute;
        }
开发者ID:AutoTestNET,项目名称:AutoTest.ArgumentNullException,代码行数:17,代码来源:DefaultExecutionSetup.cs

示例15: GetBaseMethods

        public static IEnumerable<MethodData> GetBaseMethods(MethodData method)
        {
            var lastBaseMethod = method;
            var baseMethod = method.Base;

            while (lastBaseMethod != baseMethod) {
                yield return baseMethod;

                lastBaseMethod = baseMethod;
                baseMethod = baseMethod.Base;
            }
        }
开发者ID:ashmind,项目名称:ashmind-code,代码行数:12,代码来源:Inheritance.cs


注:本文中的MethodData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。