NStub.CSharp.CSharpCodeGenerator.CreateStubForCodeMemberMethod C# (CSharp) Method

CreateStubForCodeMemberMethod() private static method

Creates the stub for the code member method. This method actually implements the method body for the test method.
private static CreateStubForCodeMemberMethod ( CodeMemberMethod codeMemberMethod ) : void
codeMemberMethod System.CodeDom.CodeMemberMethod The code member method.
return void
        private static void CreateStubForCodeMemberMethod(CodeMemberMethod codeMemberMethod)
        {
            // Clean the member name and append 'Test' to the end of it
            codeMemberMethod.Name = Utility.ScrubPathOfIllegalCharacters(codeMemberMethod.Name);
            codeMemberMethod.Name = codeMemberMethod.Name + "Test";

            // Standard test methods accept no parameters and return void.
            codeMemberMethod.ReturnType = new CodeTypeReference(typeof(void));
            codeMemberMethod.Parameters.Clear();

            codeMemberMethod.CustomAttributes.Add(
                new CodeAttributeDeclaration(
                    new CodeTypeReference(typeof(TestAttribute))));
            codeMemberMethod.CustomAttributes.Add(
                new CodeAttributeDeclaration(
                    new CodeTypeReference(typeof(IgnoreAttribute))));
            codeMemberMethod.Statements.Add(
                new CodeCommentStatement(
                    "TODO: Implement unit test for " +
                    codeMemberMethod.Name));
        }