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

MSVIEWSS_S01_TC03_AddView_EmptyQuery() private method

private MSVIEWSS_S01_TC03_AddView_EmptyQuery ( ) : void
return void
        public void MSVIEWSS_S01_TC03_AddView_EmptyQuery()
        {
            // Call AddView method to add a list view with an empty query.
            string listName = TestSuiteBase.ListGUID;
            string displayName = this.GenerateRandomString(5);

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

            AddViewQuery addViewQuery = new AddViewQuery();

            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!");

            this.Site.Assert.IsNotNull(addViewResponseAddViewResult.View.Query, "There should be a query in the view.");
            this.Site.Assert.IsNull(addViewResponseAddViewResult.View.Query.OrderBy, "The OrderBy clause of Query must be null.");
            this.Site.Assert.IsNull(addViewResponseAddViewResult.View.Query.Where, "The Where clause of Query must be null.");

            // Get the count of the items in the view.
            int itemCountOfEmptyQuery = TestSuiteBase.SutControlAdapter.GetItemsCount(TestSuiteBase.ListGUID, viewName);

            int expectAllItemsCount = int.Parse(Common.GetConfigurationPropertyValue("AllItemsCount", this.Site));

            // If the protocol server returns all the items of the list in the view, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual(
                expectAllItemsCount,
                itemCountOfEmptyQuery,
                94,
                @"[In AddView] When the value of the query element is empty, the protocol server MUST create the list view without any additional restriction.");            
        }