Wcf – How to specify list parameters in WCF Test Client (WcfTestClient.exe)

wcf

I am using WCF Test Client (WcfTestClient.exe) for testing one of my wcf services.
I have a message contract which has a list of DataContracts as :
My message contract is as follows :

[MessageContract]
    public class UpdateInvoiceStatusesRequest 
    {
        private List<InvoiceStatusHistory> _invoiceStatusHistory;

        [MessageBodyMember(Order = 0)]
        public List<InvoiceStatusHistory> InvoiceStatusHistory
        {
            get { return _invoiceStatusHistory; }
            set { _invoiceStatusHistory = value; }
        }    
    }

and my data contract is :

[DataContract]
    public class InvoiceStatusHistory
    {
        private int _invoiceId;
        private int  _status;
        private string _comment;
        private string _timeStamp;

        [DataMember]
        public int InvoiceId
        {
            get { return _invoiceId; }
            set { _invoiceId = value; }
        }

        [DataMember]
        public string Comment
        {
            get { return _comment; }
            set { _comment= value; }
        }

        [DataMember]
        public int Status
        {
            get { return _status; }
            set { _status = value; }
        }

        [DataMember]
        public string TimeStamp
        {
            get { return _timeStamp; }
            set { _timeStamp = value; }
        }
    }

when i am using WcfTestClient.exe to test the service with UpdateInvoiceStatusesRequest message contract it shows the value of InvoiceStatusHistory as length = 0, now i don't know how can i add the objects of InvoiceStatusHistory in List<InvoiceStatusHistory> ?
Does anyone has any idea about it, please help me?

Best Answer

Type length=1 in the box. A + sign will appear next to the request parameter name. Click on it, then on the [0] node which indicates the first element in the array and set its values as usual.

Related Topic