Inheritance: BasicObject
Exemple #1
0
        /// <summary>
        /// Deserialize items from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains response message.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        /// <param name="lengthOfItems">The length of items.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.AppliedStorageIndexID = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.DataElementAdded      = BasicObject.Parse <ExGUIDArray>(byteArray, ref index);

            currentIndex = currentIndex + lengthOfItems;
        }
        /// <summary>
        /// Deserialize items from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains response message.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        /// <param name="lengthOfItems">The length of items.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.AppliedStorageIndexID = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.DataElementAdded      = BasicObject.Parse <ExGUIDArray>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "PutChangesResponse", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
 /// <summary>
 /// Initializes a new instance of the ExGUIDArray class, this is copy constructor.
 /// </summary>
 /// <param name="extendGuidArray">Specify the ExGUIDArray where copies from.</param>
 public ExGUIDArray(ExGUIDArray extendGuidArray)
     : this(extendGuidArray.Content)
 {
 }
 /// <summary>
 /// Initializes a new instance of the DataElementIDsFilter class
 /// </summary>
 /// <param name="dataElementIDs">Specify the data element ID</param>
 public DataElementIDsFilter(ExGUIDArray dataElementIDs)
     : base(FilterType.DataElementIDsFilter)
 {
    this.DataElementIDs = new ExGUIDArray(dataElementIDs);
    this.QueryChangesFilterDataElementIDs = new StreamObjectHeaderStart32bit(StreamObjectTypeHeaderStart.QueryChangesFilterDataElementIDs, this.DataElementIDs.SerializeToByteList().Count);
 }
        public void TestCase_S12_TC11_QueryChanges_DataElementIDsFilter_Include()
        {
            if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 10003, this.Site))
            {
                Site.Assume.Inconclusive("Implementation does not support Query Changes sub-request with filters in the current test suite.");
            }

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            FsshttpbCellRequest cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest();
            QueryChangesCellSubRequest queryChange = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, true, 0, true, true, 0, null, 100, null, null);
            cellRequest.AddSubRequest(queryChange, null);
            CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64());
            CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest });
            CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponse, 0, 0, this.Site);
            this.Site.Assert.AreEqual<ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the query changes succeed.");
            FsshttpbResponse queryResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site);
            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(queryResponse, this.Site);

            // Get the first element id.
            ExGuid e1 = queryResponse.DataElementPackage.DataElements[0].DataElementExtendedGUID;

            List<ExGuid> extendedGuid = new List<ExGuid>();
            extendedGuid.Add(e1);
            ExGUIDArray extendedArray = new ExGUIDArray(extendedGuid);
            DataElementIDsFilter filterType = new DataElementIDsFilter(extendedArray);
            filterType.FilterOperation = 1;
            AllFilter allFilter = new AllFilter();
            allFilter.FilterOperation = 0;

            List<Filter> filters = new List<Filter>();
            filters.Add(allFilter);
            filters.Add(filterType);

            // Query change with the data element id.
            cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest();
            queryChange = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, true, 0, true, true, 0, null, 100, filters, null);
            cellRequest.AddSubRequest(queryChange, null);
            cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64());
            cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest });
            subResponse = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponse, 0, 0, this.Site);
            this.Site.Assert.AreEqual<ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the query changes succeed.");
            queryResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site);
            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(queryResponse, this.Site);

            bool isOnlyReturnSpecifiedId = queryResponse.DataElementPackage.DataElements.All(dataElement => dataElement.DataElementExtendedGUID.Equals(e1));

            this.Site.Assert.IsTrue(
                isOnlyReturnSpecifiedId,
                "The server only responses the data element with the specified extended guid {0}",
                e1.GUID);
        }
 /// <summary>
 /// Initializes a new instance of the ExGUIDArray class, this is copy constructor.
 /// </summary>
 /// <param name="extendGuidArray">Specify the ExGUIDArray where copies from.</param>
 public ExGUIDArray(ExGUIDArray extendGuidArray)
     : this(extendGuidArray.Content)
 {
 }
 /// <summary>
 /// Initializes a new instance of the DataElementIDsFilter class
 /// </summary>
 /// <param name="dataElementIDs">Specify the data element ID</param>
 public DataElementIDsFilter(ExGUIDArray dataElementIDs)
     : base(FilterType.DataElementIDsFilter)
 {
     this.DataElementIDs = new ExGUIDArray(dataElementIDs);
     this.QueryChangesFilterDataElementIDs = new StreamObjectHeaderStart32bit(StreamObjectTypeHeaderStart.QueryChangesFilterDataElementIDs, this.DataElementIDs.SerializeToByteList().Count);
 }
        /// <summary>
        /// Deserialize items from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains response message.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        /// <param name="lengthOfItems">The length of items.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;
            this.AppliedStorageIndexID = BasicObject.Parse<ExGuid>(byteArray, ref index);
            this.DataElementAdded = BasicObject.Parse<ExGUIDArray>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "PutChangesResponse", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }