/// <summary> /// Creates a set of interesting homogeneous collection value test descriptors along with metadata. /// </summary> /// <param name="settings">The settings for the payload reader test descriptor to use.</param> /// <param name="withMetadata">true if the generated test descriptors should have metadata.</param> /// <param name="withTypeNames">true if the collection value payloads should specify type names.</param> /// <param name="withExpectedType">true if an expected type annotation should be added to the generated payload element; otherwise false.</param> /// <param name="withcollectionName">true if the collection is not in the top level, otherwise false</param> /// <param name="fullSet">true if all available collection values should be returned, false if only the most interesting subset should be returned.</param> /// <returns>List of interesting test descriptors.</returns> internal static IEnumerable <PayloadReaderTestDescriptor> CreateHomogeneousCollectionValueTestDescriptors( PayloadReaderTestDescriptor.Settings settings, bool withMetadata, bool withTypeNames, bool withExpectedType, bool withcollectionName, bool fullSet = true) { EdmModel model = withMetadata ? new EdmModel() : null; IEnumerable <ODataPayloadElementCollection> collectionValues = TestValues.CreateHomogeneousCollectionValues(model, withTypeNames, withExpectedType, withcollectionName, fullSet); return(collectionValues.Select(collectionValue => { PayloadReaderTestDescriptor testDescriptor = new PayloadReaderTestDescriptor(settings) { PayloadElement = collectionValue, PayloadEdmModel = model }; if (withExpectedType && !withTypeNames) { // fill in the type names for the expected result payload since they will be added based on the expected type testDescriptor.ExpectedResultNormalizers.Add(tc => FillTypeNamesFromTypeAnnotationsPayloadElementVisitor.Visit); } if (!withExpectedType) { testDescriptor.ExpectedResultNormalizers.Add( tc => (Func <ODataPayloadElement, ODataPayloadElement>)null); } // Do not run the test descriptor if we do not have an expected type in JSON Light because it would fail. testDescriptor.SkipTestConfiguration = tc => tc.Format == ODataFormat.Json && !withExpectedType; return testDescriptor; })); }