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

MSVIEWSS_S01_TC12_AddView_EmptyType() private method

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

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

            AddViewQuery addViewQuery = new AddViewQuery();
            addViewQuery.Query = this.GetCamlQueryRootForWhere(false);

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

            AddViewResponseAddViewResult addViewResponseAddViewResult = Adapter.AddView(listName, displayName, viewFields, addViewQuery, rowLimit, string.Empty, true);
            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);

            // If the new default view is added successfully, the original default view lost its default view position.
            this.Site.Assert.IsNotNull(addViewResponseAddViewResult.View.DefaultView, "The response element \"addViewResponseAddViewResult.View.DefaultView\" should not be null.");
            this.Site.Assert.AreEqual("true", addViewResponseAddViewResult.View.DefaultView.ToLower(), "The added view should be a default view.");
            if (TestSuiteBase.OriginalDefaultViewName != null)
            {
                if (TestSuiteBase.OriginalDefaultViewLost == false)
                {
                    TestSuiteBase.OriginalDefaultViewLost = true;
                }
            }

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

            // If the protocol server set the value of type is "Html" when it is an empty value, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual<string>(
                ViewType.Html.ToString().ToUpper(),
                addViewResponseAddViewResult.View.Type.ToString().ToUpper(),
                10002,
                @"[In type] When this element[type] has an empty value, the protocol server MUST take it with a value of ""Html"".");
        }