/// <summary> /// Determines the name of the test method. /// </summary> /// <param name="context">The build context of the test method member.</param> /// <param name="originalName">The initial name of the test method member.</param> /// <returns> /// The name of the test method. /// </returns> protected override string DetermineTestName(IMemberSetupContext context, string originalName) { // var typeMember = context.TypeMember; var typeMemberName = originalName; // typeMember.Name; var propertyName = typeMemberName.Replace("get_", string.Empty).Replace("set_", string.Empty); // var methodMemberInfo = typeMember.UserData[NStubConstants.TestMemberMethodInfoKey]; // typeMember.Name = "Property" + propertyName + "NormalBehavior"; var result = "Property" + propertyName; /*if (typeMember.Name.Contains("get_")) * { * typeMember.Name = typeMember.Name.Replace("get_", "Property"); * } * else if (typeMember.Name.Contains("set_")) * { * typeMember.Name = typeMember.Name.Replace("set_", "Property"); * }*/ // typeMember.Name += "NormalBehavior"; // result = result.Replace("Test", "NormalBehavior"); return(result); // Todo: return a Test name and a test description ... for the todo. }
/// <summary> /// Determines the name of the test method. /// </summary> /// <param name="context">The build context of the test method member.</param> /// <param name="originalName">The initial name of the test method member.</param> /// <returns> /// The name of the test method. /// </returns> protected override string DetermineTestName(IMemberSetupContext context, string originalName) { // var typeMember = context.TypeMember; var typeMemberName = originalName; // typeMember.Name; var propertyName = typeMemberName.Replace(".ctor", "Constructor"); return(propertyName); }
/// <summary> /// Determines the name of the test method. /// </summary> /// <param name="context">The build context of the test method member.</param> /// <param name="originalName">The initial name of the test method member.</param> /// <returns> /// The name of the test method. /// </returns> protected override string DetermineTestName(IMemberSetupContext context, string originalName) { var typeMemberName = originalName; if (typeMemberName.Contains("add_")) { typeMemberName = typeMemberName.Replace("add_", "Event"); } else if (typeMemberName.Contains("remove_")) { typeMemberName = typeMemberName.Replace("remove_", "Event"); } typeMemberName = typeMemberName.Replace("Test", "AddAndRemove"); return(typeMemberName); }
/// <summary> /// Initializes a new instance of the <see cref="MethodBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public MethodBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="RenamingBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public RenamingBuilder(IMemberSetupContext context) : base(context) { }
//private static readonly EmptyBuildParameters Defaults = new EmptyBuildParameters(); #endregion #region Constructors /// <summary> /// Initializes a new instance of the <see cref="MemberBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> protected MemberBuilder(IMemberSetupContext context) { Guard.NotNull(() => context, context); this.SetupContext = context; }
/// <summary> /// Determines the name of the test method. /// </summary> /// <param name="context">The build context of the test method member.</param> /// <param name="originalName">The initial name of the test method member.</param> /// <returns> /// The name of the test method. /// </returns> /// <remarks>The builders are called one after one, so an integral name resolution happens.</remarks> protected virtual string DetermineTestName(IMemberSetupContext context, string originalName) { return(originalName); }
/// <summary> /// Initializes a new instance of the <see cref="RenamingBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public RenamingBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="MultiBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> protected MultiBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="PropertyGetBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public PropertyGetBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="DefaultMethodEraser"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public DefaultMethodEraser(IMemberSetupContext context) : base(context) { }
/// <summary> /// Determines the name of the test method. /// </summary> /// <param name="context">The build context of the test method member.</param> /// <param name="originalName">The initial name of the test method member.</param> /// <returns> /// The name of the test method. /// </returns> protected override string DetermineTestName(IMemberSetupContext context, string originalName) { // var typeMember = context.TypeMember; var typeMemberName = originalName; // typeMember.Name; var propertyName = typeMemberName.Replace("get_", string.Empty).Replace("set_", string.Empty); // var methodMemberInfo = typeMember.UserData[NStubConstants.TestMemberMethodInfoKey]; // typeMember.Name = "Property" + propertyName + "NormalBehavior"; var result = "Property" + propertyName; /*if (typeMember.Name.Contains("get_")) { typeMember.Name = typeMember.Name.Replace("get_", "Property"); } else if (typeMember.Name.Contains("set_")) { typeMember.Name = typeMember.Name.Replace("set_", "Property"); }*/ // typeMember.Name += "NormalBehavior"; // result = result.Replace("Test", "NormalBehavior"); return result; // Todo: return a Test name and a test description ... for the todo. }
/// <summary> /// Initializes a new instance of the <see cref="EventBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public EventBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="MemberBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> protected MemberBuilder(IMemberSetupContext context) { Guard.NotNull(() => context, context); this.SetupContext = context; }
/// <summary> /// Initializes a new instance of the <see cref="MultiBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> protected MultiBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Determines the name of the test method. /// </summary> /// <param name="context">The build context of the test method member.</param> /// <param name="originalName">The initial name of the test method member.</param> /// <returns> /// The name of the test method. /// </returns> protected override string DetermineTestName(IMemberSetupContext context, string originalName) { return originalName; }
/// <summary> /// Initializes a new instance of the <see cref="StaticMethodBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public StaticMethodBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="ConstructorBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public ConstructorBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="PropertyGetBuilder"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public PropertyGetBuilder(IMemberSetupContext context) : base(context) { }
/// <summary> /// Initializes a new instance of the <see cref="DefaultMethodEraser"/> class. /// </summary> /// <param name="context">The build context of the test method member.</param> public DefaultMethodEraser(IMemberSetupContext context) : base(context) { }