Microsoft.Protocols.TestSuites.MS_ASCMD.S07_GetItemEstimate.MSASCMD_S07_TC04_GetItemEstimate_Email_FilterType C# (CSharp) Method

MSASCMD_S07_TC04_GetItemEstimate_Email_FilterType() private method

private MSASCMD_S07_TC04_GetItemEstimate_Email_FilterType ( ) : void
return void
        public void MSASCMD_S07_TC04_GetItemEstimate_Email_FilterType()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Options element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Send an email from user1 to user2
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);            
            this.SwitchUser(this.User2Information);
            this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User2Information.InboxCollectionId));

            #region Call GetItemEstimate with FilterType setting to 0 to get estimate number of all items in Inbox folder.
            GetItemEstimateResponse getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 0);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
            int original = Convert.ToInt32(getItemEstimateResponse.ResponseData.Response[0].Collection.Estimate);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2999");

            // Verify MS-ASCMD requirement: MS-ASCMD_R2999
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
                2999,
                @"[In FilterType(GetItemEstimate)] Yes. [Applies to email, if FilterType is 0, Status element value is 1.]");
            #endregion

            #region Call GetItemEstimate without FilterType
            getItemEstimateResponse = this.CMDAdapter.GetItemEstimate(TestSuiteBase.CreateGetItemEstimateRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, null));
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
            int current = Convert.ToInt32(getItemEstimateResponse.ResponseData.Response[0].Collection.Estimate);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2970");

            // Verify MS-ASCMD requirement: MS-ASCMD_R2970
            Site.CaptureRequirementIfAreEqual<int>(
                original,
                current,
                2970,
                @"[In FilterType(GetItemEstimate)] If the airsync:FilterType element is omitted, then all objects are sent from the server.");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 1 to get estimate number of the items within 1 day in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 1);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
            original = Convert.ToInt32(getItemEstimateResponse.ResponseData.Response[0].Collection.Estimate);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3000");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3000
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
                3000,
                @"[In FilterType(GetItemEstimate)] Yes. [Applies to email, if FilterType is 1, Status element value is 1.]");
            #endregion

            #region Send an email from user1 to user2
            this.SwitchUser(this.User1Information);
            string anotherEmailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, anotherEmailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            this.CheckEmail(this.User2Information.InboxCollectionId, anotherEmailSubject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, anotherEmailSubject);

            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User2Information.InboxCollectionId));
            #endregion

            #region Call GetItemEstimate with FilterType setting to 1 to get estimate number of the items within 1 day in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 1);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
            current = Convert.ToInt32(getItemEstimateResponse.ResponseData.Response[0].Collection.Estimate);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2969");

            // Verify MS-ASCMD requirement: MS-ASCMD_R2969
            Site.CaptureRequirementIfAreEqual<int>(
                original + 1,
                current,
                2969,
                @"[In FilterType(GetItemEstimate)] New objects are added to the client when they are within the time window.");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 2 to get estimate number of the items within 3 days in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 2);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3001");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3001
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
                3001,
                @"[In FilterType(GetItemEstimate)] Yes. [Applies to email, if FilterType is 2, Status element value is 1.]");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 3 to get estimate number of the items within 1 week in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 3);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3002");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3002
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
                3002,
                @"[In FilterType(GetItemEstimate)] Yes. [Applies to email, if FilterType is 3, Status element value is 1.]");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 4 to get estimate number of the items within 2 weeks in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 4);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3003");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3003
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
                3003,
                @"[In FilterType(GetItemEstimate)] Yes. [Applies to email, if FilterType is 4, Status element value is 1.]");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 5 to get estimate number of the items within 1 month in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 5);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3004");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3004
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
                3004,
                @"[In FilterType(GetItemEstimate)] Yes. [Applies to email, if FilterType is 5, Status element value is 1.]");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 6 to get estimate number of items within 3 months in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 6);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3005");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3005
            Site.CaptureRequirementIfAreEqual<int>(
                110,
                int.Parse(getItemEstimateResponse.ResponseData.Status),
                3005,
                @"[In FilterType(GetItemEstimate)] No,[Applies to email, if FilterType is 6,] Status element value 110");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 7 to get estimate number of items within 6 months in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 7);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3006");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3006
            Site.CaptureRequirementIfAreEqual<int>(
                110,
                int.Parse(getItemEstimateResponse.ResponseData.Status),
                3006,
                @"[In FilterType(GetItemEstimate)] No,[Applies to email, if FilterType is 7,] Status element value 110");
            #endregion

            #region Call GetItemEstimate with FilterType setting to 8 to get estimate number of incomplete tasks in Inbox folder.
            getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User2Information.InboxCollectionId, 8);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3007");

            // Verify MS-ASCMD requirement: MS-ASCMD_R3007
            Site.CaptureRequirementIfAreEqual<int>(
                110,
                int.Parse(getItemEstimateResponse.ResponseData.Status),
                3007,
                @"[In FilterType(GetItemEstimate)] No, [Applies to email, if FilterType is 8,] Status element value is 110.");
            #endregion
        }