/// <summary>
        /// This operation is used to update a list view for a specified list, including display properties in CAML and HTML.
        /// </summary>
        /// <param name="listName">Specify a list on the server.</param>
        /// <param name="viewName">Specify a list view on the server.</param>
        /// <param name="viewProperties">Specify the properties of a list view on the server.</param>
        /// <param name="toolbar">Specify the rendering of the toolbar of a list.</param>
        /// <param name="viewHeader">Specify the rendering of the header, or the top of a list view page.</param>
        /// <param name="viewBody">Specify the rendering of the main, or the middle portion of a list view page.</param>
        /// <param name="viewFooter">Specify the rendering of the footer, or the bottom of a list view page.</param>
        /// <param name="viewEmpty">Specify the message to be displayed when no items are in a list view.</param>
        /// <param name="rowLimitExceeded">Specify rendering of additional items when the number of items exceeds the value.</param>
        /// <param name="query">Include the information that affects how a list view displays the data.</param>
        /// <param name="viewFields">Specify the fields included in a list view.</param>
        /// <param name="aggregations">The type of the aggregation.</param>
        /// <param name="formats">Specify the row and column formatting of a list view.</param>
        /// <param name="rowLimit">Specify whether a list supports displaying items page-by-page, and the count of items a list view displays per page.</param>
        /// <returns>The result returns a View that the type is ViewDefinition if the operation succeeds</returns>
        public UpdateViewHtmlResponseUpdateViewHtmlResult UpdateViewHtml(
            string listName,
            string viewName,
            UpdateViewHtmlViewProperties viewProperties,
            UpdateViewHtmlToolbar toolbar,
            UpdateViewHtmlViewHeader viewHeader,
            UpdateViewHtmlViewBody viewBody,
            UpdateViewHtmlViewFooter viewFooter,
            UpdateViewHtmlViewEmpty viewEmpty,
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded,
            UpdateViewHtmlQuery query,
            UpdateViewHtmlViewFields viewFields,
            UpdateViewHtmlAggregations aggregations,
            UpdateViewHtmlFormats formats,
            UpdateViewHtmlRowLimit rowLimit)
        {
            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult;

            try
            {
                updateViewHtmlResult = this.viewssProxy.UpdateViewHtml(
                    listName,
                    viewName,
                    viewProperties,
                    toolbar,
                    viewHeader,
                    viewBody,
                    viewFooter,
                    viewEmpty,
                    rowLimitExceeded,
                    query,
                    viewFields,
                    aggregations,
                    formats,
                    rowLimit);

                // Used to validate the transport requirements.
                this.CaptureTransportRelatedRequirements();

                // Used to validate the UpdateViewHtml schema requirements.
                this.ValidateUpdateViewHtmlResult(updateViewHtmlResult);
            }
            catch (SoapException soapException)
            {
                this.Site.Log.Add(
                    LogEntryKind.Debug,
                    @"There is an exception generated when calling [UpdateViewHtml] method:\r\n{0}",
                    soapException.Detail.InnerXml);

                // Used to validate the transport requirements.
                this.CaptureTransportRelatedRequirements();

                // Used to validate the schema of SoapFault.
                this.ValidateSOAPFaultDetails(soapException.Detail);

                throw;
            }

            return(updateViewHtmlResult);
        }
        public void MSVIEWSS_S04_TC17_UpdateViewHtml_FalseCollapse()
        {
            // Call AddView method to add a list view for the specified list on the server.
            string viewName = this.AddView(false, Query.IsNotCollapse, ViewType.Html);
            string listName = TestSuiteBase.ListGUID;

            // Call UpdateViewHtml method to update the display name of the list view added above.
            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            viewProperties.View = new UpdateViewPropertiesDefinition();
            viewProperties.View.DisplayName = this.GenerateRandomString(10);

            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForGroupBy(false);

            UpdateViewHtmlViewFields viewFields = new UpdateViewHtmlViewFields();
            viewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult = Adapter.UpdateViewHtml(
                                                                                       listName,
                                                                                       viewName,
                                                                                       viewProperties,
                                                                                       toolbar,
                                                                                       viewHeader,
                                                                                       viewBody,
                                                                                       viewFooter,
                                                                                       viewEmpty,
                                                                                       rowLimitExceeded,
                                                                                       queryValue,
                                                                                       viewFields,
                                                                                       aggregations,
                                                                                       formats,
                                                                                       rowLimitValue);
            this.Site.Assert.IsNotNull(updateViewHtmlResult, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");

            // Call GetView method to get the list view updated above.
            GetViewHtmlResponseGetViewHtmlResult getViewHtml = Adapter.GetViewHtml(listName, viewName);
            this.Site.Assert.IsNotNull(getViewHtml, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(getViewHtml.View, "The response element \"getViewHtml.View\" should not be null.");
            this.Site.Assert.IsNotNull(getViewHtml.View.DisplayName, "The response element \"getViewHtml.View.DisplayName\" should not be null.");
            this.Site.Assert.AreEqual(getViewHtml.View.DisplayName, viewProperties.View.DisplayName, "The fields in the list view updated in the step above should be got successfully!");

            // Call SUT control adapter method GetItemsCount to get the count of the list items in the specified view.
            int itemCollapseCount = SutControlAdapter.GetItemsCount(listName, viewName);
            int expectItemCollapseCount = int.Parse(Common.GetConfigurationPropertyValue("AllItemsCount", this.Site));

            // When the collapse attribute is false, even there are field values that can be grouped up, the number of view's items is the same as the number of all items in the list, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual(
                expectItemCollapseCount,
                itemCollapseCount,
                "MS-WSSCAML",
                67,
                @"[In Attributes] Otherwise[In GroupByDefinition: If Collapse is false], the number of rows in the result set MUST NOT be affected by the GroupBy element.");
        }
        public void MSVIEWSS_S04_TC16_UpdateViewHtml_LogicalJoinDefinitionWithoutChild()
        {
            // Call AddView method to add a list view for the specified list on the server.
            string viewName = this.AddView(false, Query.AvailableQueryInfo, ViewType.Html);
            string listName = TestSuiteBase.ListGUID;
          
            // Call UpdateViewHtml method to update the query condition when there are no child elements in LogicalJoinDefinition.
            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();

            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForGroupBy(false);

            UpdateViewHtmlViewFields viewFields = new UpdateViewHtmlViewFields();
            viewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult = Adapter.UpdateViewHtml(
                                                                                       listName,
                                                                                       viewName,
                                                                                       viewProperties,
                                                                                       toolbar,
                                                                                       viewHeader,
                                                                                       viewBody,
                                                                                       viewFooter,
                                                                                       viewEmpty,
                                                                                       rowLimitExceeded,
                                                                                       queryValue,
                                                                                       viewFields,
                                                                                       aggregations,
                                                                                       formats,
                                                                                       rowLimitValue);
            this.Site.Assert.IsNotNull(updateViewHtmlResult, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");

            // Call SUT control adapter method GetItemsCount to get the count of the list items in the specified view. 
            int itemCountWithoutLogicalJoinDefinition = SutControlAdapter.GetItemsCount(listName, viewName);
            int expectItemCountWithoutLogicalJoinDefinition = int.Parse(Common.GetConfigurationPropertyValue("AllItemsCount", this.Site));
                       
            // If there are no child elements in LogicalJoinDefinition, that is to say the query is empty query, then the number of view's items should be equal to the number of all items in the list, then MS-WSSCAML_R2501 can be captured.
            Site.CaptureRequirementIfAreEqual(
                expectItemCountWithoutLogicalJoinDefinition,
                itemCountWithoutLogicalJoinDefinition,
                "MS-WSSCAML",
                2501,
                @"[In LogicalJoinDefinition Type] When there are no child elements[in the element of LogicalJoinDefinition type], no additional conditions apply to the query.");
        }
        public void MSVIEWSS_S04_TC14_UpdateViewHtml_TrueCollapse_NoComputedFields()
        {
            this.Site.Assume.IsTrue(Common.IsRequirementEnabled(1507, this.Site), @"The test case is executed only when R1507Enabled is set to true.");

            // Call AddView method to add a list view for the specified list on the server.
            string viewName = this.AddView(false, Query.IsCollapse, ViewType.Grid);
            string listName = TestSuiteBase.ListGUID;

            // Call UpdateViewHtml method to update the display name of the list view added above.
            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            viewProperties.View = new UpdateViewPropertiesDefinition();
            viewProperties.View.DisplayName = this.GenerateRandomString(10);

            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForGroupBy(true);

            UpdateViewHtmlViewFields viewFields = new UpdateViewHtmlViewFields();
            viewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult = Adapter.UpdateViewHtml(
                                                                                        listName,
                                                                                        viewName,
                                                                                        viewProperties,
                                                                                        toolbar,
                                                                                        viewHeader,
                                                                                        viewBody,
                                                                                        viewFooter,
                                                                                        viewEmpty,
                                                                                        rowLimitExceeded,
                                                                                        queryValue,
                                                                                        viewFields,
                                                                                        aggregations,
                                                                                        formats,
                                                                                        rowLimitValue);
            this.Site.Assert.IsNotNull(updateViewHtmlResult, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");

            // Call GetViewHtml method to get the list view updated above.
            GetViewHtmlResponseGetViewHtmlResult getViewHtml = Adapter.GetViewHtml(listName, viewName);
            this.Site.Assert.IsNotNull(getViewHtml, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(getViewHtml.View, "The response element \"getViewHtml.View\" should not be null.");
            this.Site.Assert.IsNotNull(getViewHtml.View.DisplayName, "The response element \"getViewHtml.View.DisplayName\" should not be null.");
            this.Site.Assert.AreEqual(viewProperties.View.DisplayName, getViewHtml.View.DisplayName, "The fields in the list view updated in the step above should be got successfully!");

            // Call SUT control adapter method GetItemsCount to get the count of the list items in the specified view.
            int itemCollapseCount = SutControlAdapter.GetItemsCount(listName, viewName);
            int expectItemCollapseCount = int.Parse(Common.GetConfigurationPropertyValue("AllItemsCount", this.Site));

            // When the collapse attribute is true, if the number of view's items is the same as the number of all items in the list, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual(
                expectItemCollapseCount,
                itemCollapseCount,
                1507,
                @"[In Appendix B: Product Behavior] Implementation does not restrict the number of rows present in the result set to the number of unique tuples where a tuple is a set of field values when there aren't any computed fields in the ViewFields section if Collapse is true.(Windows SharePoint Services 2.0 and above products follow this behavior.)");
        }
        public void MSVIEWSS_S04_TC02_UpdateViewHtml_InvalidListName()
        {
            // Call AddView method to add a list view for the specified list on the server.
            string viewName = this.AddView(false, Query.AvailableQueryInfo, ViewType.Html);

            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForWhere(false);

            UpdateViewHtmlViewFields updateViewFields = new UpdateViewHtmlViewFields();
            updateViewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            aggregations.Aggregations = this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            bool caughtSoapException = false;

            // Call UpdateViewHtml method with invalid listName.
            try
            {
                Adapter.UpdateViewHtml(
                                        this.GenerateRandomString(10),
                                        viewName,
                                        viewProperties,
                                        toolbar,
                                        viewHeader,
                                        viewBody,
                                        viewFooter,
                                        viewEmpty,
                                        rowLimitExceeded,
                                        queryValue,
                                        updateViewFields,
                                        aggregations,
                                        formats,
                                        rowLimitValue);
            }
            catch (SoapException soapException)
            {
                caughtSoapException = true; 

                // If the server returns SOAP fault, then capture this requirement.
                Site.CaptureRequirementIfIsNotNull(
                    soapException,
                    13,
                    "[In listName] If the value of listName element is not the name or GUID of a list, the operation MUST return a SOAP fault message.");
            }

            this.Site.Assert.IsTrue(caughtSoapException, "There should be a SOAP exception in the response."); 
        }
        public void MSVIEWSS_S04_TC12_CompareUpdateViewHtmlResult()
        {
            // Call AddView method to add a list view for the specified list on the server.           
            string viewName = this.AddView(true, Query.AvailableQueryInfo, ViewType.Html);
            string listName = TestSuiteBase.ListGUID;

            // Call UpdateViewHtml method to update the display name of the view added above.
            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            viewProperties.View = new UpdateViewPropertiesDefinition();
            viewProperties.View.DisplayName = this.GenerateRandomString(10);
            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForWhere(false);

            UpdateViewHtmlViewFields updateViewFields = new UpdateViewHtmlViewFields();
            updateViewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult = Adapter.UpdateViewHtml(
                                                                                       listName,
                                                                                       viewName,
                                                                                       viewProperties,
                                                                                       toolbar,
                                                                                       viewHeader,
                                                                                       viewBody,
                                                                                       viewFooter,
                                                                                       viewEmpty,
                                                                                       rowLimitExceeded,
                                                                                       queryValue,
                                                                                       updateViewFields,
                                                                                       aggregations,
                                                                                       formats,
                                                                                       rowLimitValue);
            this.Site.Assert.IsNotNull(updateViewHtmlResult, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");

            // Call UpdateViewHtml2 method to update the display name of the view when openApplicationExtension is set to null and all other parameters are same as above UpdateViewHtml method.
            UpdateViewHtml2ViewProperties viewProperties2 = new UpdateViewHtml2ViewProperties();
            viewProperties2.View = new UpdateViewPropertiesDefinition();
            viewProperties2.View.DisplayName = viewProperties.View.DisplayName;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtml2Query queryValue2 = new UpdateViewHtml2Query();
            queryValue.Query = this.GetCamlQueryRootForWhere(false);

            UpdateViewHtml2ViewFields viewFields = new UpdateViewHtml2ViewFields();
            viewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtml2Aggregations aggregations2 = new UpdateViewHtml2Aggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtml2Formats formats2 = new UpdateViewHtml2Formats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtml2RowLimit rowLimitValue2 = new UpdateViewHtml2RowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtml2ResponseUpdateViewHtml2Result updateViewHtml2Result = Adapter.UpdateViewHtml2(
                                                                                       listName,
                                                                                       viewName,
                                                                                       viewProperties2,
                                                                                       null,
                                                                                       null,
                                                                                       null,
                                                                                       null,
                                                                                       null,
                                                                                       null,
                                                                                       queryValue2,
                                                                                       viewFields,
                                                                                       aggregations2,
                                                                                       formats2,
                                                                                       rowLimitValue2,
                                                                                       null);

            this.Site.Assert.IsNotNull(updateViewHtml2Result, "The updated view html2 should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtml2Result.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");

            // Compare the two responses returned by UpdateViewHtml and UpdateViewHtml2.
            bool isSame = this.DoCompare(updateViewHtmlResult.View, updateViewHtml2Result.View);
            
            // If the two responses are equal, then capture this requirement.
            Site.CaptureRequirementIfIsTrue(
                isSame,
                12501,
                @"[In UpdateViewHtml] When processing this call[[UpdateViewHtml]], the protocol server MUST return the same results as for the UpdateViewHtml2 method (section 3.1.4.8) with parameter openApplicationExtension as empty.");
        }
        public void MSVIEWSS_S04_TC10_UpdateViewHtml_AllParameters()
        {
            // Call AddView method to add a list view for the specified list on the server.
            string listName = TestSuiteBase.ListGUID;          
            string viewName = this.AddView(false, Query.AvailableQueryInfo, ViewType.Html);
            
            // Call UpdateViewHtml method to update the FPModified.
            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            viewProperties.View = new UpdateViewPropertiesDefinition();
            viewProperties.View.FPModified = "true";
            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForWhere(false);

            UpdateViewHtmlViewFields updateViewFields = new UpdateViewHtmlViewFields();
            updateViewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult = Adapter.UpdateViewHtml(
                                                                                       listName,
                                                                                       viewName,
                                                                                       viewProperties,
                                                                                       toolbar,
                                                                                       viewHeader,
                                                                                       viewBody,
                                                                                       viewFooter,
                                                                                       viewEmpty,
                                                                                       rowLimitExceeded,
                                                                                       queryValue,
                                                                                       updateViewFields,
                                                                                       aggregations,
                                                                                       formats,
                                                                                       rowLimitValue);
            this.Site.Assert.IsNotNull(updateViewHtmlResult, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");

            // Call GetViewHtml method to get the list view updated above.
            GetViewHtmlResponseGetViewHtmlResult getViewHtml = Adapter.GetViewHtml(listName, viewName);
            this.Site.Assert.IsNotNull(getViewHtml, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(getViewHtml.View, "The response element \"getViewHtml.View\" should not be null.");
            this.Site.Assert.IsNotNull(getViewHtml.View.FPModified, "The response element \"getViewHtml.View.FPModified\" should not be null.");
            this.Site.Assert.AreEqual("true", getViewHtml.View.FPModified.ToLower(), "The updated FPModified should be got successfully!");

            // The protocol server successfully updates the default list view and return a View element that specifies the list view, so capture this requirement.
                Site.CaptureRequirement(
                    127,
                    @"[In UpdateViewHtmlResponse] UpdateViewHtmlResult: If the protocol server successfully updates the list view, it MUST return a View element that specifies the list view.");
        }
        public void MSVIEWSS_S04_TC08_UpdateViewHtml_EmptyViewName()
        {
            string listName = TestSuiteBase.ListGUID;

            // Add a default view.
            this.AddView(true, Query.EmptyQueryInfo, ViewType.Grid);
                    
            // Call UpdateViewHtml method to update the Scope of the view with empty viewName.
            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            viewProperties.View = new UpdateViewPropertiesDefinition();
            viewProperties.View.Scope = ViewScope.Item;
            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForWhere(false);

            UpdateViewHtmlViewFields updateViewFields = new UpdateViewHtmlViewFields();
            updateViewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult = Adapter.UpdateViewHtml(
                                                                                        listName,
                                                                                        string.Empty,
                                                                                        viewProperties,
                                                                                        toolbar,
                                                                                        viewHeader,
                                                                                        viewBody,
                                                                                        viewFooter,
                                                                                        viewEmpty,
                                                                                        rowLimitExceeded,
                                                                                        queryValue,
                                                                                        updateViewFields,
                                                                                        aggregations,
                                                                                        formats,
                                                                                        rowLimitValue);
            this.Site.Assert.IsNotNull(updateViewHtmlResult, "The updated view html should be got successfully.");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View, "The server should return a View element that specifies the list view when the UpdateViewHtml method succeeds!");
            this.Site.Assert.IsNotNull(updateViewHtmlResult.View.DefaultView, "The response element \"updateViewHtmlResult.View.DefaultView\" should not be null.");

            // If the protocol server refers to the default list view of the list when viewName element is empty, then capture below requirement.
            Site.CaptureRequirementIfAreEqual(
                "true",
                updateViewHtmlResult.View.DefaultView.ToLower(),
                2302,
                @"[In viewName] When the value of viewName element is empty, the protocol server MUST refer to the default list view of the list.");
        }
        public void MSVIEWSS_S04_TC18_UpdateViewHtml_EmptyViewName_NoDefaultView()
        {
            string listName = TestSuiteBase.ListGUID;

            // Add a default view.
            string defaultViewName = AddView(true, Query.EmptyQueryInfo, ViewType.Grid);

            // Delete the default view.
            this.DeleteView(defaultViewName);

            UpdateViewHtmlViewProperties viewProperties = new UpdateViewHtmlViewProperties();
            viewProperties.View = new UpdateViewPropertiesDefinition();
            viewProperties.View.DisplayName = this.GenerateRandomString(10);

            UpdateViewHtmlToolbar toolbar;
            UpdateViewHtmlViewHeader viewHeader;
            UpdateViewHtmlViewBody viewBody;
            UpdateViewHtmlViewFooter viewFooter;
            UpdateViewHtmlViewEmpty viewEmpty;
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded;

            this.GetHtmlConfigure(
                                out toolbar,
                                out viewHeader,
                                out viewBody,
                                out viewFooter,
                                out viewEmpty,
                                out rowLimitExceeded);

            UpdateViewHtmlQuery queryValue = new UpdateViewHtmlQuery();
            queryValue.Query = this.GetCamlQueryRootForGroupBy(false);

            UpdateViewHtmlViewFields viewFields = new UpdateViewHtmlViewFields();
            viewFields.ViewFields = this.GetViewFields(false);

            UpdateViewHtmlAggregations aggregations = new UpdateViewHtmlAggregations();
            this.GetAggregationsDefinition(true, true, Common.GetConfigurationPropertyValue("FieldRefAggregations_AggregationsType", this.Site));

            UpdateViewHtmlFormats formats = new UpdateViewHtmlFormats();
            formats.Formats = this.GetViewFormatDefinitions();

            UpdateViewHtmlRowLimit rowLimitValue = new UpdateViewHtmlRowLimit();
            rowLimitValue.RowLimit = this.GetAvailableRowLimitDefinition();

            bool caughtSoapException = false; 

            // Call UpdateViewHtml method to update the display name of the view with an empty viewName.
            try
            {
                Adapter.UpdateViewHtml(
                            listName,
                            string.Empty,
                            viewProperties,
                            toolbar,
                            viewHeader,
                            viewBody,
                            viewFooter,
                            viewEmpty,
                            rowLimitExceeded,
                            queryValue,
                            viewFields,
                            aggregations,
                            formats,
                            rowLimitValue);                
            }
            catch (SoapException soapException)
            {
                caughtSoapException = true; 

                // If server returns an exception when the default list view does not exist, then capture below requirement.
                Site.CaptureRequirementIfIsNotNull(
                    soapException,
                    24,
                    @"[In viewName] If the default list view does not exist, the protocol server MUST return a SOAP fault message.");
            }

            this.Site.Assert.IsTrue(caughtSoapException, "There should be a SOAP exception in the response."); 
        }
        /// <summary>
        /// This operation is used to update a list view for a specified list, including display properties in CAML and HTML.
        /// </summary>
        /// <param name="listName">Specify a list on the server.</param>
        /// <param name="viewName">Specify a list view on the server.</param>
        /// <param name="viewProperties">Specify the properties of a list view on the server.</param>
        /// <param name="toolbar">Specify the rendering of the toolbar of a list.</param>
        /// <param name="viewHeader">Specify the rendering of the header, or the top of a list view page.</param>
        /// <param name="viewBody">Specify the rendering of the main, or the middle portion of a list view page.</param>
        /// <param name="viewFooter">Specify the rendering of the footer, or the bottom of a list view page.</param>
        /// <param name="viewEmpty">Specify the message to be displayed when no items are in a list view.</param>
        /// <param name="rowLimitExceeded">Specify rendering of additional items when the number of items exceeds the value.</param>
        /// <param name="query">Include the information that affects how a list view displays the data.</param>
        /// <param name="viewFields">Specify the fields included in a list view.</param>
        /// <param name="aggregations">The type of the aggregation.</param> 
        /// <param name="formats">Specify the row and column formatting of a list view.</param>
        /// <param name="rowLimit">Specify whether a list supports displaying items page-by-page, and the count of items a list view displays per page.</param>
        /// <returns>The result returns a View that the type is ViewDefinition if the operation succeeds</returns>
        public UpdateViewHtmlResponseUpdateViewHtmlResult UpdateViewHtml(
            string listName,
            string viewName,
            UpdateViewHtmlViewProperties viewProperties,
            UpdateViewHtmlToolbar toolbar,
            UpdateViewHtmlViewHeader viewHeader,
            UpdateViewHtmlViewBody viewBody,
            UpdateViewHtmlViewFooter viewFooter,
            UpdateViewHtmlViewEmpty viewEmpty,
            UpdateViewHtmlRowLimitExceeded rowLimitExceeded,
            UpdateViewHtmlQuery query,
            UpdateViewHtmlViewFields viewFields,
            UpdateViewHtmlAggregations aggregations,
            UpdateViewHtmlFormats formats,
            UpdateViewHtmlRowLimit rowLimit)
        {
            UpdateViewHtmlResponseUpdateViewHtmlResult updateViewHtmlResult;

            try 
            {
                updateViewHtmlResult = this.viewssProxy.UpdateViewHtml(
                listName,
                viewName,
                viewProperties,
                toolbar,
                viewHeader,
                viewBody,
                viewFooter,
                viewEmpty,
                rowLimitExceeded,
                query,
                viewFields,
                aggregations,
                formats,
                rowLimit);

                // Used to validate the transport requirements.
                this.CaptureTransportRelatedRequirements();

                // Used to validate the UpdateViewHtml schema requirements.
                this.ValidateUpdateViewHtmlResult(updateViewHtmlResult);
            }
            catch (SoapException soapException)
            {
                this.Site.Log.Add(
                                LogEntryKind.Debug,
                                @"There is an exception generated when calling [UpdateViewHtml] method:\r\n{0}",
                                soapException.Detail.InnerXml);

                // Used to validate the transport requirements.
                this.CaptureTransportRelatedRequirements();

                // Used to validate the schema of SoapFault.
                this.ValidateSOAPFaultDetails(soapException.Detail);

                throw;
            }

            return updateViewHtmlResult;
        }