Microsoft.Protocols.TestSuites.MS_VIEWSS.S04_MaintainViewProperties.MSVIEWSS_S04_TC18_UpdateViewHtml_EmptyViewName_NoDefaultView C# (CSharp) Method

MSVIEWSS_S04_TC18_UpdateViewHtml_EmptyViewName_NoDefaultView() private method

        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."); 
        }