C# Класс Microsoft.Protocols.TestSuites.MS_LISTSWS.TestSuiteHelper

A class that provides helper methods used in test case level.
Показать файл Открыть проект

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

Метод Описание
AddFieldsToList ( string listId, List fieldNames, List fieldTypes, List viewNames ) : void

This method is used to add specified fields to the specified list. All the added field will be not required fields. If any error occurs, this will fail the test case.

AddFieldsToList ( string listId, List fieldNames, List fieldTypes, bool isRequired, List viewNames ) : void

This method is used to add specified fields to the specified list. If any error occurs, this will fail the test case.

AddListItemWithMetaInfoProperty ( string list, string propertyName, string propertyValue ) : string

A method is used to insert one item which only contains "MetaInfo" field value. This method is constraint to only add one property to the lookup type "MetaInfo" field.

AddListItems ( string list, int itemCount ) : List

A method is used to add list items by specified number items to specified list. This method update the column value specified by ListFieldText property in the PTF configuration file, and the value of this column is specified by random generated string.

CleanUp ( ) : void

A method used to Clean up lists added by Test Case Helper. Any lists added by Test Case Helper would be deleted.

CreateAddContentTypeFields ( ) : AddOrUpdateFieldsDefinition

Construct added fields for the UpdateContentType operation using the specified field names.

CreateAddListFieldsRequest ( List fieldNames, List fieldTypes, List viewNames ) : UpdateListFieldsRequest

This method is used to construct UpdateListFieldsRequest instance for UpdateList operation's add fields parameter. All the fields will be constructed as not required fields.

CreateContentType ( string list, string displayName, List fieldNames ) : string

Create a content type on the list.

CreateDeleteContentTypeFields ( ) : DeleteFieldsDefinition

Construct deleted fields for the UpdateContentType operation using the specified field names.

CreateDeleteListFieldsRequest ( List fieldNames ) : UpdateListFieldsRequest

This method is used to construct UpdateListFieldsRequest instance for UpdateList operation's delete fields parameter.

CreateList ( ) : string

A method used to Create a list by configured list name and configured list template

CreateList ( int templateId ) : string

A method used to Create a list by configured list name and specified list template.

CreateList ( string listName ) : string

A method used to Create a list by specified list name and configured list template.

CreateList ( string listName, int templateId ) : string

A method used to Create a list by specified list name and template Id

CreateNewDocument ( string elementName, string uri, string innerXml ) : XmlNode

This method is used to construct a new document XmlNode.

CreateQueryRoot ( string fieldName, string fieldValue ) : CamlQueryRoot

A method used to construct CamlQueryRoot instance using specified field name and value with equal condition.

CreateUpdateContentTypeFields ( ) : AddOrUpdateFieldsDefinition

Construct updated fields for the UpdateContentType operation using the specified field names. This will update the field display name add a word "New" in the prefix before old name.

CreateUpdateListItems ( List methods, string>.List fieldNameValuePairs ) : UpdateListItemsUpdates

A method used to construct UpdateListItemsUpdates instance using the specified parameters.

CreateUpdateListItems ( List methodCollection, string>.List fieldNameValuePairs, OnErrorEnum errorhandleType ) : UpdateListItemsUpdates

A method used to construct UpdateListItemsUpdates instance using the specified parameters.

CreateUpdateListWithKnowledgeItems ( List methods, string>.List fieldNameValuePairs ) : UpdateListItemsWithKnowledgeUpdates

A method used to construct UpdateListItemsWithKnowledgeUpdates instance using the specified parameters.

CreateUpdateListWithKnowledgeItems ( List methods, string>.List fieldNameValuePairs, OnErrorEnum errorhandleType ) : UpdateListItemsWithKnowledgeUpdates

A method used to construct UpdateListItemsWithKnowledgeUpdates instance using the specified parameters.

CreateViewFields ( bool property, List fieldNames ) : CamlViewFields

A method used to construct CamlViewFields instance using the specified parameters.

DeepCompare ( object objectLeft, object objectRight ) : bool

A method is used to deep compare two object.

GenerateRandomNumber ( int minValue, int maxValue ) : string

This method is used to random generate an integer in the specified range.

GenerateRandomString ( int size ) : string

This method is used to generate random string in the range A-Z with the specified string size.

GenerateVersionNumber ( ) : string

A method is used to generate a random version number in the format X.0.0.XXX.

GetAttachmentContent ( string fileName ) : byte[]

Get the content in the file of specified file name.

GetAttachmentFullUrl ( string listId, string itemId, string attachmentFileName ) : string

A method used to get full URL of an attachment

GetContentTypeId ( string listName, string name ) : string

Get the content type id in the specified list name and use the specified content type name.

GetErrorCode ( System.Web.Services.Protocols.SoapException exp ) : string

Extract the error code from the SoapException response.

GetErrorString ( System.Web.Services.Protocols.SoapException exp ) : string

Extract the error string from the SoapException response.

GetFirstExistContentTypeName ( string listId ) : string

A method used to get a existed Content Type, it is used in set a parent type value in CreateContentType operation.

GetInvalidGuidAndNocorrespondString ( ) : string

A method used to Get an invalid format GUID string, it is not corresponds to any list's title

GetListDefinition ( string listId ) : ListDefinitionSchema

This method is used to get the specified list definition.

GetMessageDataForAddDiscussionBoardItem ( ) : byte[]

A method is used to Get a valid format message data for AddDiscussionBoardItem operation

GetOwsHiddenVersion ( string list ) : string

A method used to get the valid OwsHiddenVersion for specified list item

GetUniqueContentTypeName ( ) : string

A method is used to get a Unique ContentType Name

GetUniqueFieldName ( ) : string

A method is used to get a Unique field Name

GetUniqueFolderName ( ) : string

A method is used to get a Unique folder Name

GetUniqueListItemName ( ) : string

A method is used to get a Unique List item Name

GetUniqueListName ( ) : string

A method is used to get a Unique List Name

GetUniqueMetaInfoFieldPropertyName ( ) : string

A method is used to get a Unique MetaInfoField Property Name

GuardEnviromentClean ( ) : bool

A method used to verify whether current environment is clean status

Initialize ( ITestSite site, IMS_LISTSWSAdapter adapter ) : void

A method used to Initialize the TestSuiteHelper with specified ITestSite instance and IMS_LISTSWSAdapter instance

RemoveList ( string listId ) : bool

A method used to remove list by specified list id

RemoveListItems ( string list, List deleteIDList, OnErrorEnum errorEnum ) : void

Delete the specified items in the specified list.

UpdateListItems ( string list, List updateIds, OnErrorEnum errorEnum ) : void

Update the specified items' List.FieldText configured column in the specified list to the "NewTextField" value.

Приватные методы

Метод Описание
AddListItem ( string list, UpdateListItemsUpdates updates ) : string

A method is used to insert one item to the specified list.

CreateAddListFieldsRequest ( List fieldNames, List fieldTypes, bool isRequired, List viewNames ) : UpdateListFieldsRequest

This method is used to construct UpdateListFieldsRequest instance for UpdateList operation's add fields parameter.

CreateContentType ( string list, string displayName, string title, string description, string parentTypeId, AddOrUpdateFieldsDefinition addField ) : string

This method is used to Create a content type using the specified information.

GetUniqueNameByObjectName ( string objectName, uint counter ) : string

A method is used to get a Unique Name by specified object name and counter.

SerializerHelp ( object targetObject, Type type ) : string

This method is used to serialize an object to string.

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

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

This method is used to add specified fields to the specified list. All the added field will be not required fields. If any error occurs, this will fail the test case.
public static AddFieldsToList ( string listId, List fieldNames, List fieldTypes, List viewNames ) : void
listId string Specify the list which will be added fields.
fieldNames List Specify the added fields names.
fieldTypes List Specify the added fields types.
viewNames List A parameter represents the whether added field to a view. If it is null, the field will not be added to any view. If it is empty string, the field will not be added to default view
Результат void

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

This method is used to add specified fields to the specified list. If any error occurs, this will fail the test case.
public static AddFieldsToList ( string listId, List fieldNames, List fieldTypes, bool isRequired, List viewNames ) : void
listId string Specify the list which will be added fields.
fieldNames List Specify the added fields names.
fieldTypes List Specify the added fields types.
isRequired bool Specify all the added fields whether required or not.
viewNames List A parameter represents the view to which the field should be added. If it is null, the field will not be added to any view. If it is empty string, the field will be added to default view
Результат void

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

A method is used to insert one item which only contains "MetaInfo" field value. This method is constraint to only add one property to the lookup type "MetaInfo" field.
public static AddListItemWithMetaInfoProperty ( string list, string propertyName, string propertyValue ) : string
list string A parameter represents list GUID or list title.
propertyName string A parameter represents one property name for the lookup type "MetaInfo" field.
propertyValue string A parameter represents the property value for the corresponding property name.
Результат string

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

A method is used to add list items by specified number items to specified list. This method update the column value specified by ListFieldText property in the PTF configuration file, and the value of this column is specified by random generated string.
public static AddListItems ( string list, int itemCount ) : List
list string A parameter represents list GUID or list title
itemCount int A parameter represents how many items would be added into the list
Результат List

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

A method used to Clean up lists added by Test Case Helper. Any lists added by Test Case Helper would be deleted.
public static CleanUp ( ) : void
Результат void

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

Construct added fields for the UpdateContentType operation using the specified field names.
public static CreateAddContentTypeFields ( ) : AddOrUpdateFieldsDefinition
Результат Microsoft.Protocols.TestSuites.Common.AddOrUpdateFieldsDefinition

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

This method is used to construct UpdateListFieldsRequest instance for UpdateList operation's add fields parameter. All the fields will be constructed as not required fields.
public static CreateAddListFieldsRequest ( List fieldNames, List fieldTypes, List viewNames ) : UpdateListFieldsRequest
fieldNames List A parameter represents the fields to be added.
fieldTypes List A parameter represents the field types to be added.
viewNames List A parameter represents the view to which the field should be added. If it is null, the field will not be added to any view. If it is empty string, the field will be added to default view
Результат Microsoft.Protocols.TestSuites.Common.UpdateListFieldsRequest

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

Create a content type on the list.
public static CreateContentType ( string list, string displayName, List fieldNames ) : string
list string The list title or list id which the content type is created on.
displayName string The contented display name.
fieldNames List The fields of the created content type.
Результат string

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

Construct deleted fields for the UpdateContentType operation using the specified field names.
public static CreateDeleteContentTypeFields ( ) : DeleteFieldsDefinition
Результат Microsoft.Protocols.TestSuites.Common.DeleteFieldsDefinition

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

This method is used to construct UpdateListFieldsRequest instance for UpdateList operation's delete fields parameter.
public static CreateDeleteListFieldsRequest ( List fieldNames ) : UpdateListFieldsRequest
fieldNames List A parameter represents the fields to be deleted.
Результат Microsoft.Protocols.TestSuites.Common.UpdateListFieldsRequest

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

A method used to Create a list by configured list name and configured list template
public static CreateList ( ) : string
Результат string

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

A method used to Create a list by configured list name and specified list template.
public static CreateList ( int templateId ) : string
templateId int A parameter represents the templateId of list template
Результат string

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

A method used to Create a list by specified list name and configured list template.
public static CreateList ( string listName ) : string
listName string A parameter represents the list name.
Результат string

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

A method used to Create a list by specified list name and template Id
public static CreateList ( string listName, int templateId ) : string
listName string A parameter represents the list name
templateId int A parameter represents the templateId of list template
Результат string

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

This method is used to construct a new document XmlNode.
public static CreateNewDocument ( string elementName, string uri, string innerXml ) : XmlNode
elementName string A parameter represents he Xml node's element name.
uri string A parameter represents he Xml node's element namespace URI.
innerXml string A parameter represents he Xml node's inner xml content.
Результат System.Xml.XmlNode

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

A method used to construct CamlQueryRoot instance using specified field name and value with equal condition.
public static CreateQueryRoot ( string fieldName, string fieldValue ) : CamlQueryRoot
fieldName string A parameter represents the field name.
fieldValue string A parameter represents the field value.
Результат Microsoft.Protocols.TestSuites.Common.CamlQueryRoot

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

Construct updated fields for the UpdateContentType operation using the specified field names. This will update the field display name add a word "New" in the prefix before old name.
public static CreateUpdateContentTypeFields ( ) : AddOrUpdateFieldsDefinition
Результат Microsoft.Protocols.TestSuites.Common.AddOrUpdateFieldsDefinition

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

A method used to construct UpdateListItemsUpdates instance using the specified parameters.
public static CreateUpdateListItems ( List methods, string>.List fieldNameValuePairs ) : UpdateListItemsUpdates
methods List A list of MethodCmdEnum to specify the operations.
fieldNameValuePairs string>.List A list of items values.
Результат UpdateListItemsUpdates

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

A method used to construct UpdateListItemsUpdates instance using the specified parameters.
public static CreateUpdateListItems ( List methodCollection, string>.List fieldNameValuePairs, OnErrorEnum errorhandleType ) : UpdateListItemsUpdates
methodCollection List A list of MethodCmdEnum to specify the operations.
fieldNameValuePairs string>.List A list of items values.
errorhandleType OnErrorEnum Specify the OnError of the Batch element's value.
Результат UpdateListItemsUpdates

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

A method used to construct UpdateListItemsWithKnowledgeUpdates instance using the specified parameters.
public static CreateUpdateListWithKnowledgeItems ( List methods, string>.List fieldNameValuePairs ) : UpdateListItemsWithKnowledgeUpdates
methods List A list of MethodCmdEnum to specify the operations.
fieldNameValuePairs string>.List A list of items values.
Результат UpdateListItemsWithKnowledgeUpdates

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

A method used to construct UpdateListItemsWithKnowledgeUpdates instance using the specified parameters.
public static CreateUpdateListWithKnowledgeItems ( List methods, string>.List fieldNameValuePairs, OnErrorEnum errorhandleType ) : UpdateListItemsWithKnowledgeUpdates
methods List A list of MethodCmdEnum to specify the operations.
fieldNameValuePairs string>.List A list of items values.
errorhandleType OnErrorEnum Specify the OnError of the Batch element's value.
Результат UpdateListItemsWithKnowledgeUpdates

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

A method used to construct CamlViewFields instance using the specified parameters.
public static CreateViewFields ( bool property, List fieldNames ) : CamlViewFields
property bool A Boolean value indicate whether the Prosperities attribute value is TRUE/FALSE
fieldNames List Specified the CamlViewFields instance's fields.
Результат Microsoft.Protocols.TestSuites.Common.CamlViewFields

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

A method is used to deep compare two object.
public static DeepCompare ( object objectLeft, object objectRight ) : bool
objectLeft object Specify the left object instance.
objectRight object Specify the right object instance.
Результат bool

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

This method is used to random generate an integer in the specified range.
public static GenerateRandomNumber ( int minValue, int maxValue ) : string
minValue int The inclusive lower bound of the random number returned.
maxValue int The exclusive upper bound of the random number returned.
Результат string

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

This method is used to generate random string in the range A-Z with the specified string size.
public static GenerateRandomString ( int size ) : string
size int A parameter represents the generated string size.
Результат string

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

A method is used to generate a random version number in the format X.0.0.XXX.
public static GenerateVersionNumber ( ) : string
Результат string

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

Get the content in the file of specified file name.
public static GetAttachmentContent ( string fileName ) : byte[]
fileName string The specified file name
Результат byte[]

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

A method used to get full URL of an attachment
public static GetAttachmentFullUrl ( string listId, string itemId, string attachmentFileName ) : string
listId string A parameter represents current list
itemId string A parameter represents the list item where the method would search attachment
attachmentFileName string A parameter represents the attachment fie name which is used to key work
Результат string

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

Get the content type id in the specified list name and use the specified content type name.
public static GetContentTypeId ( string listName, string name ) : string
listName string The specified list name
name string The specified content type name
Результат string

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

Extract the error code from the SoapException response.
public static GetErrorCode ( System.Web.Services.Protocols.SoapException exp ) : string
exp System.Web.Services.Protocols.SoapException The specified SoapException.
Результат string

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

Extract the error string from the SoapException response.
public static GetErrorString ( System.Web.Services.Protocols.SoapException exp ) : string
exp System.Web.Services.Protocols.SoapException The specified SoapException.
Результат string

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

A method used to get a existed Content Type, it is used in set a parent type value in CreateContentType operation.
public static GetFirstExistContentTypeName ( string listId ) : string
listId string A parameter represents the identification of a list
Результат string

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

A method used to Get an invalid format GUID string, it is not corresponds to any list's title
public static GetInvalidGuidAndNocorrespondString ( ) : string
Результат string

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

This method is used to get the specified list definition.
public static GetListDefinition ( string listId ) : ListDefinitionSchema
listId string The specified list id which needs to be retrieved list definition.
Результат Microsoft.Protocols.TestSuites.Common.ListDefinitionSchema

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

A method is used to Get a valid format message data for AddDiscussionBoardItem operation
public static GetMessageDataForAddDiscussionBoardItem ( ) : byte[]
Результат byte[]

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

A method used to get the valid OwsHiddenVersion for specified list item
public static GetOwsHiddenVersion ( string list ) : string
list string A parameter represents the list where the method will target
Результат string

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

A method is used to get a Unique ContentType Name
public static GetUniqueContentTypeName ( ) : string
Результат string

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

A method is used to get a Unique field Name
public static GetUniqueFieldName ( ) : string
Результат string

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

A method is used to get a Unique folder Name
public static GetUniqueFolderName ( ) : string
Результат string

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

A method is used to get a Unique List item Name
public static GetUniqueListItemName ( ) : string
Результат string

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

A method is used to get a Unique List Name
public static GetUniqueListName ( ) : string
Результат string

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

A method is used to get a Unique MetaInfoField Property Name
public static GetUniqueMetaInfoFieldPropertyName ( ) : string
Результат string

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

A method used to verify whether current environment is clean status
public static GuardEnviromentClean ( ) : bool
Результат bool

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

A method used to Initialize the TestSuiteHelper with specified ITestSite instance and IMS_LISTSWSAdapter instance
public static Initialize ( ITestSite site, IMS_LISTSWSAdapter adapter ) : void
site ITestSite A parameter represents ITestSite instance.
adapter IMS_LISTSWSAdapter A parameter represents IMS_LISTSWSAdapter instance.
Результат void

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

A method used to remove list by specified list id
public static RemoveList ( string listId ) : bool
listId string A parameter represents the list id
Результат bool

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

Delete the specified items in the specified list.
public static RemoveListItems ( string list, List deleteIDList, OnErrorEnum errorEnum ) : void
list string A parameter represents the list title or list id.
deleteIDList List Specify the delete items id.
errorEnum OnErrorEnum Specify how to affect the following sequence when one delete item method fails.
Результат void

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

Update the specified items' List.FieldText configured column in the specified list to the "NewTextField" value.
public static UpdateListItems ( string list, List updateIds, OnErrorEnum errorEnum ) : void
list string A parameter represents the list title or list id.
updateIds List A parameter represents the update items ids.
errorEnum OnErrorEnum A parameter represents when error occurs, the following sequence will continue or return.
Результат void