Microsoft.Protocols.TestSuites.MS_VIEWSS.S01_AddDeleteViews.MSVIEWSS_S01_TC15_AddView_TrueCollapse_NoComputedFields C# (CSharp) Method

MSVIEWSS_S01_TC15_AddView_TrueCollapse_NoComputedFields() private method

        public void MSVIEWSS_S01_TC15_AddView_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 without computed fields in viewFields and collapse is set to true in the query condition.
            string listName = TestSuiteBase.ListGUID;
            string displayName = this.GenerateRandomString(5);

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

            AddViewQuery addViewQuery = new AddViewQuery();
            addViewQuery.Query = this.GetCamlQueryRootForGroupBy(true);

            AddViewRowLimit rowLimit = new AddViewRowLimit();
            rowLimit.RowLimit = this.GetAvailableRowLimitDefinition();

            string type = ViewType.Grid.ToString();               

            AddViewResponseAddViewResult addViewResponseAddViewResult = Adapter.AddView(listName, displayName, viewFields, addViewQuery, rowLimit, type, false);
            this.Site.Assert.IsNotNull(addViewResponseAddViewResult, "The added view should be got successfully.");
            this.Site.Assert.IsNotNull(addViewResponseAddViewResult.View, "The server should return a View element that specifies the list view when the AddView method is successful!");

            // Put the newly added view into ViewPool.
            string viewName = addViewResponseAddViewResult.View.Name;
            TestSuiteBase.ViewPool.Add(viewName);

            // Call GetView method to get the list view created above.
            GetViewResponseGetViewResult getView = Adapter.GetView(listName, viewName);
            this.Site.Assert.IsNotNull(getView, "The created list view should be got successfully.");
            this.Site.Assert.IsNotNull(getView.View, "The response element \"getView.View\" should not be null.");
            this.Site.Assert.IsNotNull(getView.View.DisplayName, "The response element \"getView.View.DisplayName\" should not be null.");
            this.Site.Assert.AreEqual(displayName, getView.View.DisplayName, "The list view added in the step above should be got successfully!");

            // Call GetItemsCount method 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.)");
        }