private void VerifyListDefinitionSchema(ListDefinitionSchema listDefinitionSchema)
{
this.Site.Assert.IsNotNull(listDefinitionSchema, "The ListDefinitionSchema should not be null.");
// Verify R1418
// The response have been received successfully, then the following requirement can be captured.
// If the response is not received and parsed successfully, the test case will fail before this requirement is captured
Site.CaptureRequirement(
1418,
@"[ListDefinitionSchema]Specifies the results from retrieving a specified list.");
if (listDefinitionSchema.Validation != null)
{
if (listDefinitionSchema.Validation.Message != null)
{
bool isLengthLessThan1024 = listDefinitionSchema.Validation.Message.Length <= 1024;
// Verify MS-LISTSWS requirement: MS-LISTSWS_R2381 and MS-LISTSWS_R2380
// If the length of the Validation is not greater than 1024, then the following
// requirement can be captured.
if (Common.IsRequirementEnabled(2381, this.Site))
{
Site.CaptureRequirementIfIsTrue(
isLengthLessThan1024,
2381,
@"[ListDefinitionSchema.Validation]Implementation does not return characters longer than 1024, if this attribute present.(Microsoft SharePoint Foundation 2010 and above follow this behavior.)");
}
if (Common.IsRequirementEnabled(2380, this.Site))
{
Site.CaptureRequirementIfIsTrue(
isLengthLessThan1024,
2380,
@"[ListDefinitionSchema.Validation.Message]Implementation does not return characters longer than 1024, if this attribute present.(Microsoft SharePoint Foundation 2010 and above follow this behavior.)");
}
}
}
// Verify R1419
// ListDefinitionSchema should have been verified by the ListsSoap.XmlValidater method.
// Thus R1419 can be captured directly here.
Site.CaptureRequirement(
1419,
@"[The schema of ListDefinitionSchema defined as:]"
+ @"<s:complexType name=""ListDefinitionSchema"">"
+ @" <s:complexContent>"
+ @" <s:extension base=""tns:ListDefinitionCT"">"
+ @" <s:sequence>"
+ @" <s:element name=""Validation"" minOccurs=""0"">"
+ @" <s:complexType>"
+ @" <s:attribute name=""Message"" type=""s:string"" use=""optional"" />"
+ @" </s:complexType>"
+ @" </s:element>"
+ @" <s:element name=""ValidationDisplayNames"" minOccurs=""0"" type=""s:string"" />"
+ @" <s:element name=""Fields"">"
+ @" <s:complexType mixed=""true"">"
+ @" <s:sequence>"
+ @" <s:element name=""Field"" "
+ @" type=""core:FieldDefinition"" "
+ @" minOccurs=""0"" maxOccurs=""unbounded"" />"
+ @" </s:sequence>"
+ @" </s:complexType>"
+ @" </s:element>"
+ @" <s:element name=""RegionalSettings"" >"
+ @" <s:complexType mixed=""true"">"
+ @" <s:sequence>"
+ @" <s:element name=""Language"" type=""s:string"" />"
+ @" <s:element name=""Locale"" type=""s:string"" />"
+ @" <s:element name=""AdvanceHijri"" type=""s:string"" />"
+ @" <s:element name=""CalendarType"" type=""s:string"" />"
+ @" <s:element name=""Time24"" type=""s:string"" />"
+ @" <s:element name=""TimeZone"" type=""s:string"" />"
+ @" <s:element name=""SortOrder"" type=""s:string"" />"
+ @" <s:element name=""Presence"" type=""s:string"" />"
+ @" </s:sequence>"
+ @" </s:complexType>"
+ @" </s:element>"
+ @" <s:element name=""ServerSettings"" >"
+ @" <s:complexType mixed=""true"">"
+ @" <s:sequence>"
+ @" <s:element name=""ServerVersion"" type=""s:string"" />"
+ @" <s:element name=""RecycleBinEnabled"" type=""core:TRUEFALSE"" />"
+ @" <s:element name=""ServerRelativeUrl"" type=""s:string"" />"
+ @" </s:sequence>"
+ @" </s:complexType>"
+ @" </s:element>"
+ @" </s:sequence>"
+ @" </s:extension>"
+ @" </s:complexContent>"
+ @"</s:complexType>");
Site.Assert.IsNotNull(listDefinitionSchema, "The ListDefinitionSchema cannot be null");
Site.Assert.IsNotNull(listDefinitionSchema.Fields, "The ListDefinitionSchema.Fields cannot be null");
// Verify R1420
if (listDefinitionSchema.Fields.Field != null)
{
if (listDefinitionSchema.Fields.Field.Length > 0)
{
// If the response contains the "Field" element, its definition should have been verified by the ListsSoap.XmlValidater method.
// Thus R1420 can be captured directly here.
Site.CaptureRequirement(
1420,
@"[ListDefinitionSchema.FieldDefinition: ]As specified in [MS-WSSFO2] section "
+ "2.2.8.3.3.[A field definition describes the structure and format of a field that "
+ "is used within a list or content type.]");
}
}
// Verify R1421
System.Globalization.CultureInfo[] cultures = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures & ~System.Globalization.CultureTypes.NeutralCultures);
bool isValidLCIDForLanguage = false;
if (listDefinitionSchema.RegionalSettings.Language != null)
{
// If the response contains the "Language" element, and the value is a valid LCID, then the following requirement can be captured.
foreach (System.Globalization.CultureInfo culture in cultures)
{
if (listDefinitionSchema.RegionalSettings.Language == culture.LCID.ToString())
{
isValidLCIDForLanguage = true;
break;
}
}
Site.CaptureRequirementIfIsTrue(
isValidLCIDForLanguage,
1421,
@"[ListDefinitionSchema.Language:] A valid language code identifier (LCID) as defined in [MS-LCID].");
}
// Verify R1422
bool isValidLCIDForLocal = false;
if (listDefinitionSchema.RegionalSettings.Locale != null)
{
// If the response contains the "Locale" element, and the value is a valid LCID, then the following requirement can be captured.
foreach (System.Globalization.CultureInfo culture in cultures)
{
if (listDefinitionSchema.RegionalSettings.Locale == culture.LCID.ToString())
{
isValidLCIDForLocal = true;
break;
}
}
Site.CaptureRequirementIfIsTrue(
isValidLCIDForLocal,
1422,
@"[ListDefinitionSchema.Locale:] A valid language code identifier (LCID) as defined in [MS-LCID].");
}
// Verify R165
// If the value is between -2 and 2, then the following requirement can be captured.
int advanceHijri = int.Parse(listDefinitionSchema.RegionalSettings.AdvanceHijri);
bool isVerifyR165 = advanceHijri >= -2 && advanceHijri <= 2;
Site.CaptureRequirementIfIsTrue(
isVerifyR165,
165,
@"[ListDefinitionSchema.AdvanceHijri] An integer between -2 and 2.");
// Verify R1423, R166
if (!string.IsNullOrEmpty(listDefinitionSchema.RegionalSettings.CalendarType))
{
// Verify MS-LISTSWS requirement: MS-LISTSWS_R1423, R166.
// The expected domain is defined in MS-WSSFO2 section 2.2.4.3. If the
// actual CalendarType value is contained in the expected domain of values, then the
// requirement can be captured.
// And these are standard values which are not configurable
string[] calendarTypeDomain = { "1", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "14", "15", "16" };
List<string> listCalendarType = new List<string>(calendarTypeDomain);
bool isVerifyR1423 = listCalendarType.Contains(listDefinitionSchema.RegionalSettings.CalendarType);
Site.CaptureRequirementIfIsTrue(
isVerifyR1423,
1423,
@"[ListDefinitionSchema.CalendarType:] Specifies the type of calendar.["
+ "The only valid values of the Calendar Type are specified as follows."
+ "Value Description"
+ "1 Gregorian (localized)"
+ "3 Japanese Emperor Era"
+ "4 Taiwan Calendar"
+ "5 Korean Tangun Era"
+ "6 Hijri (Arabic Lunar)"
+ "7 Thai"
+ "8 Hebrew (Lunar)"
+ "9 Gregorian (Middle East French)"
+ "10 Gregorian (Arabic)"
+ "11 Gregorian (Transliterated English)"
+ "12 Gregorian (Transliterated French)"
+ "14 Korean and Japan Lunar"
+ "15 Chinese Lunar"
+ "16 Saka Era]");
bool isVerifyR166 = isVerifyR1423;
Site.CaptureRequirementIfIsTrue(
isVerifyR166,
166,
@"[ListDefinitionSchema.CalendarType] See [MS-WSSFO2] section 2.2.3.3 for the "
+ "different types of calendar supported.["
+ "The only valid values of the Calendar Type are specified as follows."
+ "Value Description"
+ "1 Gregorian (localized)"
+ "3 Japanese Emperor Era"
+ "4 Taiwan Calendar"
+ "5 Korean Tangun Era"
+ "6 Hijri (Arabic Lunar)"
+ "7 Thai"
+ "8 Hebrew (Lunar)"
+ "9 Gregorian (Middle East French)"
+ "10 Gregorian (Arabic)"
+ "11 Gregorian (Transliterated English)"
+ "12 Gregorian (Transliterated French)"
+ "14 Korean and Japan Lunar"
+ "15 Chinese Lunar"
+ "16 Saka Era]");
}
if (!string.IsNullOrEmpty(listDefinitionSchema.ServerSettings.RecycleBinEnabled))
{
// Verify R1209
// If all the above requirements are verified, then the requirement can be
// captured.
Site.CaptureRequirement(
1209,
@"[In Complex Types]The Complex type ListDefinitionSchema is used Specifies the "
+ "results from retrieving a specified list.");
if (Common.IsRequirementEnabled(2418, this.Site))
{
// Verify R2418
Site.CaptureRequirementIfIsNull(
listDefinitionSchema.Validation,
2418,
@"Implementation does not return this attribute[ListDefinitionSchema.Validation]. [In Appendix B: Product Behavior] <17> Section 2.2.4.12: This attribute[ListDefinitionSchema.Validation] is not returned in Windows SharePoint Services 3.0.");
}
if (Common.IsRequirementEnabled(2420, this.Site))
{
// Verify R2420
Site.CaptureRequirementIfIsNull(
listDefinitionSchema.Validation,
2420,
@"Implementation does not return this attribute[ListDefinitionSchema.Validation.Message]. [In Appendix B: Product Behavior] <18> Section 2.2.4.12: This attribute[ListDefinitionSchema.Validation.Message] is not returned in Windows SharePoint Services 3.0.");
}
if (Common.IsRequirementEnabled(2422, this.Site))
{
// Verify R2422
Site.CaptureRequirementIfIsNull(
listDefinitionSchema.ValidationDisplayNames,
2422,
@"Implementation does not return this attribute[ListDefinitionSchema.ValidationDisplayNames]. [In Appendix B: Product Behavior] <19> Section 2.2.4.12: This attribute[ListDefinitionSchema.ValidationDisplayNames] is not returned in Windows SharePoint Services 3.0.");
}
}
}