Ejemplo n.º 1
0
        /// <summary>
        /// Add a view to the list.
        /// </summary>
        /// <param name="isDefault">Represents whether this view is a default view.</param>
        /// <param name="queryType">Represents the type of query condition of the view.</param>
        /// <param name="viewType">Represents the type of the view to be created.</param>
        /// <returns>The GUID of the view, which is also called the view name.</returns>
        protected string AddView(bool isDefault, Query queryType, ViewType viewType)
        {
            string listName = TestSuiteBase.ListGUID;

            string viewName = this.GenerateRandomString(5);

            AddViewViewFields viewFields = new AddViewViewFields();

            viewFields.ViewFields = this.GetViewFields(true);

            AddViewQuery addViewQuery = new AddViewQuery();

            addViewQuery.Query = this.GetCamlQueryRoot(queryType, false);

            AddViewRowLimit rowLimit = new AddViewRowLimit();

            rowLimit.RowLimit = this.GetAvailableRowLimitDefinition();

            string type = string.Empty;

            switch (viewType)
            {
            case ViewType.Calendar:
                type = "Calendar";
                break;

            case ViewType.Grid:
                type = "Grid";
                break;

            case ViewType.Html:
                type = "Html";
                break;

            default:
                Site.Debug.Fail("Not supported view type {0}", viewType.ToString());
                break;
            }

            AddViewResponseAddViewResult addViewResponseAddViewResult = TestSuiteBase.Adapter.AddView(
                listName,
                viewName,
                viewFields,
                addViewQuery,
                rowLimit,
                type,
                isDefault);

            this.Site.Assert.IsNotNull(addViewResponseAddViewResult.View, "The call of the AddView operation SHOULD be successful.");

            string viewGUID = addViewResponseAddViewResult.View.Name;

            if (isDefault)
            {
                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 the new default view is added successfully, the original default view lost its default view position.
                if (OriginalDefaultViewName != null)
                {
                    if (TestSuiteBase.OriginalDefaultViewLost == false)
                    {
                        TestSuiteBase.OriginalDefaultViewLost = true;
                    }
                }
            }

            TestSuiteBase.ViewPool.Add(viewGUID);
            return(addViewResponseAddViewResult.View.Name);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Used to validate the AddView result related requirements.
        /// </summary>
        /// <param name="addViewResult">Specify the result of the AddView operation.</param>
        private void ValidateAddViewResult(AddViewResponseAddViewResult addViewResult)
        {
            // Verify MS-VIEWSS requirement: MS-VIEWSS_R262
            // If the schema validation succeeds, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                this.PassSchemaValidation,
                262,
                @"[In AddViewSoapOut] The SOAP body contains an AddViewResponse element (section 3.1.4.1.2.3).");

            // Verify MS-VIEWSS requirement: MS-VIEWSS_R92
            // Since the operation succeeds without SOAP exception, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                this.PassSchemaValidation,
                92,
                "[In AddView] The protocol client sends an AddViewSoapIn request message (section 3.1.4.1.1.1), and the protocol server responds with an AddViewSoapOut response message (section 3.1.4.1.1.2).");

            // Verify MS-VIEWSS requirement: MS-VIEWSS_R8002
            // Since the operation succeeds without SOAP exception, then this requirement can be captured.
            this.Site.CaptureRequirementIfIsTrue(
                this.PassSchemaValidation,
                8002,
                @"[In AddView] The definition of the AddView operation is as follows.
                                <wsdl:operation name=""AddView"">
                                    <wsdl:input message=""tns:AddViewSoapIn"" />
                                    <wsdl:output message=""tns:AddViewSoapOut"" />
                                </wsdl:operation>");

            // Verify MS-VIEWSS requirement: MS-VIEWSS_R164
            // If the schema validation succeeds, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                this.PassSchemaValidation,
                164,
                @"[In AddViewResponse] The definition of the AddViewResponse element is as follows.
                                                                            <s:element name=""AddViewResponse"">
                                                                              <s:complexType>
                                                                                <s:sequence>
                                                                                  <s:element name=""AddViewResult"" minOccurs=""1"" maxOccurs=""1"">
                                                                                    <s:complexType>
                                                                                      <s:sequence>
                                                                                        <s:element name=""View"" type=""tns:BriefViewDefinition"" minOccurs=""1"" maxOccurs=""1""/>
                                                                                      </s:sequence>
                                                                                    </s:complexType>
                                                                                  </s:element>
                                                                                </s:sequence>
                                                                              </s:complexType>
                                                                            </s:element>");

            // If the schema validation succeeds, then this requirement MS-VIEWSS_R103 can be captured.
            Site.CaptureRequirementIfIsTrue(
                this.PassSchemaValidation,
                103,
                @"[In AddViewResponse] The type of the View element[in AddViewResult] is BriefViewDefinition, which is specified in section 2.2.4.1.");

            // Validate BriefViewDefinition related requirements.
            this.ValidateBriefViewDefinition(addViewResult.View);
        }