C# Class Microsoft.Protocols.TestSuites.MS_LISTSWS.TestSuiteHelper

A class that provides helper methods used in test case level.
Show file Open project: OfficeDev/Interop-TestSuites

Public Methods

Method Description
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.

Private Methods

Method Description
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.

Method Details

AddFieldsToList() public static method

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
return void

AddFieldsToList() public static method

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
return void

AddListItemWithMetaInfoProperty() public static method

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.
return string

AddListItems() public static method

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
return List

CleanUp() public static method

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
return void

CreateAddContentTypeFields() public static method

Construct added fields for the UpdateContentType operation using the specified field names.
public static CreateAddContentTypeFields ( ) : AddOrUpdateFieldsDefinition
return Microsoft.Protocols.TestSuites.Common.AddOrUpdateFieldsDefinition

CreateAddListFieldsRequest() public static method

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
return Microsoft.Protocols.TestSuites.Common.UpdateListFieldsRequest

CreateContentType() public static method

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.
return string

CreateDeleteContentTypeFields() public static method

Construct deleted fields for the UpdateContentType operation using the specified field names.
public static CreateDeleteContentTypeFields ( ) : DeleteFieldsDefinition
return Microsoft.Protocols.TestSuites.Common.DeleteFieldsDefinition

CreateDeleteListFieldsRequest() public static method

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.
return Microsoft.Protocols.TestSuites.Common.UpdateListFieldsRequest

CreateList() public static method

A method used to Create a list by configured list name and configured list template
public static CreateList ( ) : string
return string

CreateList() public static method

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
return string

CreateList() public static method

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.
return string

CreateList() public static method

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
return string

CreateNewDocument() public static method

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.
return System.Xml.XmlNode

CreateQueryRoot() public static method

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.
return Microsoft.Protocols.TestSuites.Common.CamlQueryRoot

CreateUpdateContentTypeFields() public static method

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
return Microsoft.Protocols.TestSuites.Common.AddOrUpdateFieldsDefinition

CreateUpdateListItems() public static method

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.
return UpdateListItemsUpdates

CreateUpdateListItems() public static method

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.
return UpdateListItemsUpdates

CreateUpdateListWithKnowledgeItems() public static method

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.
return UpdateListItemsWithKnowledgeUpdates

CreateUpdateListWithKnowledgeItems() public static method

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.
return UpdateListItemsWithKnowledgeUpdates

CreateViewFields() public static method

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.
return Microsoft.Protocols.TestSuites.Common.CamlViewFields

DeepCompare() public static method

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.
return bool

GenerateRandomNumber() public static method

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.
return string

GenerateRandomString() public static method

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.
return string

GenerateVersionNumber() public static method

A method is used to generate a random version number in the format X.0.0.XXX.
public static GenerateVersionNumber ( ) : string
return string

GetAttachmentContent() public static method

Get the content in the file of specified file name.
public static GetAttachmentContent ( string fileName ) : byte[]
fileName string The specified file name
return byte[]

GetAttachmentFullUrl() public static method

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
return string

GetContentTypeId() public static method

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
return string

GetErrorCode() public static method

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.
return string

GetErrorString() public static method

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.
return string

GetFirstExistContentTypeName() public static method

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
return string

GetInvalidGuidAndNocorrespondString() public static method

A method used to Get an invalid format GUID string, it is not corresponds to any list's title
public static GetInvalidGuidAndNocorrespondString ( ) : string
return string

GetListDefinition() public static method

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.
return Microsoft.Protocols.TestSuites.Common.ListDefinitionSchema

GetMessageDataForAddDiscussionBoardItem() public static method

A method is used to Get a valid format message data for AddDiscussionBoardItem operation
public static GetMessageDataForAddDiscussionBoardItem ( ) : byte[]
return byte[]

GetOwsHiddenVersion() public static method

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
return string

GetUniqueContentTypeName() public static method

A method is used to get a Unique ContentType Name
public static GetUniqueContentTypeName ( ) : string
return string

GetUniqueFieldName() public static method

A method is used to get a Unique field Name
public static GetUniqueFieldName ( ) : string
return string

GetUniqueFolderName() public static method

A method is used to get a Unique folder Name
public static GetUniqueFolderName ( ) : string
return string

GetUniqueListItemName() public static method

A method is used to get a Unique List item Name
public static GetUniqueListItemName ( ) : string
return string

GetUniqueListName() public static method

A method is used to get a Unique List Name
public static GetUniqueListName ( ) : string
return string

GetUniqueMetaInfoFieldPropertyName() public static method

A method is used to get a Unique MetaInfoField Property Name
public static GetUniqueMetaInfoFieldPropertyName ( ) : string
return string

GuardEnviromentClean() public static method

A method used to verify whether current environment is clean status
public static GuardEnviromentClean ( ) : bool
return bool

Initialize() public static method

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.
return void

RemoveList() public static method

A method used to remove list by specified list id
public static RemoveList ( string listId ) : bool
listId string A parameter represents the list id
return bool

RemoveListItems() public static method

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.
return void

UpdateListItems() public static method

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.
return void