本文整理汇总了C#中MethodData类的典型用法代码示例。如果您正苦于以下问题:C# MethodData类的具体用法?C# MethodData怎么用?C# MethodData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodData类属于命名空间,在下文中一共展示了MethodData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CollectDirectlyUsedBy
private void CollectDirectlyUsedBy(MethodData method)
{
method.GetReferencedMethods().Cast<IMemberData>().ForEach(this.Collect);
this.methodsByBases[method].Cast<IMemberData>().ForEach(this.Collect);
var generic = method.GetGenericDefinition();
if (generic != null)
this.Collect(generic);
var propertyOrEvent = method.DeclaringMember;
if (propertyOrEvent != null)
this.Collect(propertyOrEvent);
}
开发者ID:ashmind,项目名称:ashmind-code,代码行数:13,代码来源:UsedMemberCollector.cs
示例17: SetupThrowingExecution
public async Task SetupThrowingExecution(
[Frozen(Matching.DirectBaseType)] ApplicationException expected,
ErroredExecutionSetup sut,
MethodData methodData)
{
// Act
Func<Task> execute = ((IExecutionSetup) sut).Setup(methodData);
// Executing method should not throw but return a faulted task.
Task task = execute();
// Assert
Assert.True(task.IsFaulted);
ApplicationException actual = await Assert.ThrowsAsync<ApplicationException>(() => task);
Assert.Same(expected, actual);
}
开发者ID:AutoTestNET,项目名称:AutoTest.ArgumentNullException,代码行数:16,代码来源:ErroredExecutionSetupShould.cs
示例18: ToCode_given_ConstructorDataWithBody_should_ReturnProper
public void ToCode_given_ConstructorDataWithBody_should_ReturnProper()
{
// # Arrange.
const string ClassName = "Customer";
var sut = new MethodData
{
IsConstructor = true,
Scope = Common.VisibilityScope.Internal,
Name = ClassName,
Parameters = new List<ParameterData>
{
new ParameterData
{
Name=ClassName,
SystemTypeString = ClassName
}
},
Body = new BodyData
{
Lines= new List<string>
{
"this.CustomerId = customer.CustomerId;",
"this.CustomerName = customer.CustomerName;"
}
}
};
// # Act.
var res = sut.ToCode();
// # Assert.
CollectionAssert.AreEqual(
new[]
{
"internal Customer( Customer customer )",
"{",
"\tthis.CustomerId = customer.CustomerId;",
"\tthis.CustomerName = customer.CustomerName;",
"}"
},
res.ToList());
}
开发者ID:LosManos,项目名称:St4mpede,代码行数:43,代码来源:MethodDataTest.cs
示例19: AddNewMethod
public void AddNewMethod (MethodBase mb, int il_size)
{
if (methods == null)
methods = new ArrayList ();
MethodData md = new MethodData (mb, il_size);
md.Checked = true;
methods.Add (md);
}
开发者ID:jakesays,项目名称:mono,代码行数:9,代码来源:compiler-tester.cs
示例20: GetAccess
private static IconAccess GetAccess(MethodData method)
{
if (method.Inner.IsPrivate)
return IconAccess.Private;
if (method.Inner.IsFamily)
return IconAccess.Protected;
if (method.Inner.IsAssembly || method.Inner.IsFamilyOrAssembly)
return IconAccess.Internal;
return IconAccess.Public;
}
开发者ID:ashmind,项目名称:ashmind-code,代码行数:13,代码来源:NodeIcon.cs
注:本文中的MethodData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论