Microsoft.Protocols.TestSuites.MS_OUTSPS.MS_OUTSPSAdapter.VerifyTypeAndIdForFieldDefinition C# (CSharp) Method

VerifyTypeAndIdForFieldDefinition() private method

A method used to verify field's id or field's type is equal to expected value.
private VerifyTypeAndIdForFieldDefinition ( GetListResponseGetListResult responseOfGetList, string expectedFieldName, string expectedFieldId, string expectedFieldType ) : bool
responseOfGetList Microsoft.Protocols.TestSuites.Common.GetListResponseGetListResult A parameter represents the response of GetList operation which contains the field definitions.
expectedFieldName string A parameter represents the name of a field definition which is used to get the definition from the response of GetList operation.
expectedFieldId string A parameter represents the expected id of field definition.
expectedFieldType string A parameter represents the expected type of field definition.
return bool
        private bool VerifyTypeAndIdForFieldDefinition(GetListResponseGetListResult responseOfGetList, string expectedFieldName, string expectedFieldId, string expectedFieldType)
        {
            if (string.IsNullOrEmpty(expectedFieldName))
            {
                throw new ArgumentNullException("expectedFieldName");
            }

            // Get the field definition from response.
            FieldDefinition fieldDefinition = Common.GetFieldItemByName(responseOfGetList, expectedFieldName, this.Site);
            
            // Verify field type.
            this.Site.Assert.IsTrue(
                                    Common.VerifyFieldType(fieldDefinition, expectedFieldType, this.Site),
                                    @"The field definition's type should match the specified value in protocol.");

            // Verify field id.
            this.Site.Assert.IsTrue(
                                    Common.VerifyFieldId(fieldDefinition, expectedFieldId, this.Site),
                                    @"The field definition's id should match the specified value in protocol.");

            // If upon verifications pass, return true.
            return true;
        }   
    }