namespace XFEExtension.NetCore.XUnit; /// /// 方法测试,可自定义名称和返回值 /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public sealed class MNRTestAttribute : MRTestAttribute { /// /// 方法别名 /// public string? MethodOtherName { get; set; } /// /// 方法测试 /// /// 方法别名 /// 传参 public MNRTestAttribute(string methodOtherName, params object[] valuesAndResult) { MethodOtherName = methodOtherName; ReturnValue = valuesAndResult[valuesAndResult.Length - 1]; Params = valuesAndResult.Take(valuesAndResult.Length - 1).ToArray(); } /// /// 方法测试 /// public MNRTestAttribute() { } }