Microsoft.Protocols.TestSuites.MS_ASCAL.S01_CalendarElement.MSASCAL_S01_TC02_Sensitivity C# (CSharp) Method

MSASCAL_S01_TC02_Sensitivity() private method

private MSASCAL_S01_TC02_Sensitivity ( ) : void
return void
        public void MSASCAL_S01_TC02_Sensitivity()
        {
            #region Generate calendar subject and record them.
            Dictionary<Request.ItemsChoiceType8, object> calendarItem = new Dictionary<Request.ItemsChoiceType8, object>();

            string subjectWithSensitivity0 = Common.GenerateResourceName(Site, "subjectWithSensitivity0");
            string subjectWithSensitivity1 = Common.GenerateResourceName(Site, "subjectWithSensitivity1");
            string subjectWithSensitivity2 = Common.GenerateResourceName(Site, "subjectWithSensitivity2");
            string subjectWithSensitivity3 = Common.GenerateResourceName(Site, "subjectWithSensitivity3");

            #endregion

            #region Call Sync command to add a calendar with the element Sensitivity setting as '0' to the server, and sync calendars from the server.

            calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithSensitivity0);
            calendarItem.Add(Request.ItemsChoiceType8.Sensitivity, byte.Parse("0"));

            this.AddSyncCalendar(calendarItem);

            SyncItem calendarWithSensitivity0 = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithSensitivity0);
            Site.Assert.IsNotNull(calendarWithSensitivity0.Calendar, "The calendar with subject {0} should exist in server.", subjectWithSensitivity0);
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithSensitivity0);
            #endregion

            Site.Assert.IsNotNull(calendarWithSensitivity0.Calendar.Sensitivity, "The Sensitivity element should not be null.");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R610
            Site.CaptureRequirementIfAreEqual<byte>(
                0,
                calendarWithSensitivity0.Calendar.Sensitivity.Value,
                610,
                @"[In Sensitivity] [The value] 0 [means] Normal.");

            #region Call Sync command to add a calendar with the element Sensitivity setting as '1' to the server, and sync calendars from the server.

            calendarItem.Clear();
            calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithSensitivity1);
            calendarItem.Add(Request.ItemsChoiceType8.Sensitivity, byte.Parse("1"));
            this.AddSyncCalendar(calendarItem);

            SyncItem calendarWithSensitivity1 = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithSensitivity1);

            Site.Assert.IsNotNull(calendarWithSensitivity1.Calendar, "The calendar with subject {0} should exist in server.", subjectWithSensitivity1);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithSensitivity1);
            #endregion

            Site.Assert.IsNotNull(calendarWithSensitivity1.Calendar.Sensitivity, "The Sensitivity element should not be null.");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R611
            Site.CaptureRequirementIfAreEqual<byte>(
                1,
                calendarWithSensitivity1.Calendar.Sensitivity.Value,
                611,
                @"[In Sensitivity] [The value] 1 [means] Personal.");

            #region Call Sync command to add a calendar with the element Sensitivity setting as '2' to the server, and sync calendars from the server.

            calendarItem.Clear();
            calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithSensitivity2);
            calendarItem.Add(Request.ItemsChoiceType8.Sensitivity, byte.Parse("2"));
            this.AddSyncCalendar(calendarItem);

            SyncItem calendarWithSensitivity2 = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithSensitivity2);

            Site.Assert.IsNotNull(calendarWithSensitivity2.Calendar, "The calendar with subject {0} should exist in server.", subjectWithSensitivity2);
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithSensitivity2);
            #endregion

            Site.Assert.IsNotNull(calendarWithSensitivity2.Calendar.Sensitivity, "The Sensitivity element should not be null.");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R612
            Site.CaptureRequirementIfAreEqual<byte>(
                2,
                calendarWithSensitivity2.Calendar.Sensitivity.Value,
                612,
                @"[In Sensitivity] [The value] 2 [means] Private.");

            #region Call Sync command to add a calendar with the element Sensitivity setting as '3' to the server, and sync calendars from the server.

            calendarItem.Clear();
            calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithSensitivity3);
            calendarItem.Add(Request.ItemsChoiceType8.Sensitivity, byte.Parse("3"));
            this.AddSyncCalendar(calendarItem);

            SyncItem calendarWithSensitivity3 = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithSensitivity3);

            Site.Assert.IsNotNull(calendarWithSensitivity3.Calendar, "The calendar with subject {0} should exist in server.", subjectWithSensitivity3);
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithSensitivity3);
            #endregion

            Site.Assert.IsNotNull(calendarWithSensitivity3.Calendar.Sensitivity, "The Sensitivity element should not be null.");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R613
            Site.CaptureRequirementIfAreEqual<byte>(
                3,
                calendarWithSensitivity3.Calendar.Sensitivity.Value,
                613,
                @"[In Sensitivity] [The value] 3 [means]Confidential.");

            // According to above steps, requirement MS-ASCAL_R42111 can be covered directly.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R42111");

            // Verify MS-ASCAL requirement: MS-ASCAL_R42111
            Site.CaptureRequirement(
                42111,
                @"[In Sensitivity] As a top-level element of the Calendar class, the Sensitivity element specifies the recommended privacy policy for the calendar item.");
        }