C# Класс NStub.CSharp.ObjectGeneration.CodeMethodComposer

Provides helper methods for composition of CodeMemberMethod method members.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AppendAssertInconclusive ( CodeMemberMethod codeMemberMethod, string inconclusiveText ) : void

Appends a 'Assert.Inconclusive("Text")' statement to the specified method.

CreateAndInitializeCollectionField ( string memberCollectionField ) : CodeAssignStatement

Creates a reference to a collection based member field and initializes it with a new instance of the specified parameter type and adds a collection item to it. Sample values are used as the initializing expression.

With a custom Type, this method produces a statement with a initializer like: this.paths = new[] { pathsItem };. where the item is defined like: this.pathsItem = new PathItemType();. myType of type System.Type: this.pathsItem = "An Item";.

CreateAndInitializeMemberField ( Type type, string memberField ) : CodeAssignStatement

Creates a reference to a member field and initializes it with a new instance of the specified parameter type. Sample values are used as the initializing expression.

With a custom Type, this method produces a statement with a initializer like: this.project = new Microsoft.Build.BuildEngine.Project();. or let myInt be of type int: this.myInt = 1234;. myType of type System.Type: this.myType = typeof(System.Object);.

CreateExpressionByType ( Type type, string memberField ) : System.CodeDom.CodeExpression
CreateTestStubForMethod ( CodeMemberMethod codeMemberMethod ) : void

Creates the stub for the specified code member method. This method actually implements the method body for the test method.

Описание методов

AppendAssertInconclusive() публичный статический Метод

Appends a 'Assert.Inconclusive("Text")' statement to the specified method.
public static AppendAssertInconclusive ( CodeMemberMethod codeMemberMethod, string inconclusiveText ) : void
codeMemberMethod System.CodeDom.CodeMemberMethod The code member method.
inconclusiveText string The warning parameter text of the Assert.Inconclusive call.
Результат void

CreateAndInitializeCollectionField() публичный статический Метод

Creates a reference to a collection based member field and initializes it with a new instance of the specified parameter type and adds a collection item to it. Sample values are used as the initializing expression.
With a custom Type, this method produces a statement with a initializer like: this.paths = new[] { pathsItem };. where the item is defined like: this.pathsItem = new PathItemType();. myType of type System.Type: this.pathsItem = "An Item";.
public static CreateAndInitializeCollectionField ( string memberCollectionField ) : CodeAssignStatement
memberCollectionField string Name of the referenced collection field.
Результат System.CodeDom.CodeAssignStatement

CreateAndInitializeMemberField() публичный статический Метод

Creates a reference to a member field and initializes it with a new instance of the specified parameter type. Sample values are used as the initializing expression.
With a custom Type, this method produces a statement with a initializer like: this.project = new Microsoft.Build.BuildEngine.Project();. or let myInt be of type int: this.myInt = 1234;. myType of type System.Type: this.myType = typeof(System.Object);.
public static CreateAndInitializeMemberField ( Type type, string memberField ) : CodeAssignStatement
type System.Type Defines the type of the new object.
memberField string Name of the referenced member field.
Результат System.CodeDom.CodeAssignStatement

CreateExpressionByType() публичный статический Метод

public static CreateExpressionByType ( Type type, string memberField ) : System.CodeDom.CodeExpression
type System.Type
memberField string
Результат System.CodeDom.CodeExpression

CreateTestStubForMethod() публичный статический Метод

Creates the stub for the specified code member method. This method actually implements the method body for the test method.
public static CreateTestStubForMethod ( CodeMemberMethod codeMemberMethod ) : void
codeMemberMethod System.CodeDom.CodeMemberMethod The code member method.
Результат void