/// <summary> /// Gets test data for the given test data variation or returns null if the <see cref="TestData"/> instance /// doesn't support the given variation. /// </summary> /// <param name="variation">The test data variation with which to create the related test data.</param> /// <returns>Test data of the type specified by the <see cref="TestData.GetAsTypeOrNull"/> method.</returns> public object GetAsTestDataOrNull(TestDataVariations variation) { TestDataVariationProvider testDataVariation = null; if (this.registeredTestDataVariations.TryGetValue(variation, out testDataVariation)) { return(testDataVariation.TestDataProvider()); } return(null); }
/// <summary> /// Gets the related type for the given test data variation or returns null if the <see cref="TestData"/> instance /// doesn't support the given variation. /// </summary> /// <param name="variation">The test data variation with which to create the related <see cref="Type"/>.</param> /// <returns>The related <see cref="Type"/> for the <see cref="TestData.Type"/> as given by the test data variation.</returns> /// <example> /// For example, if the given <see cref="TestData"/> was created for <see cref="string"/> test data and the varation parameter /// was <see cref="TestDataVariations.AsList"/> then the returned type would be <see cref="List<string>"/>. /// </example> public Type GetAsTypeOrNull(TestDataVariations variation) { TestDataVariationProvider testDataVariation = null; if (this.registeredTestDataVariations.TryGetValue(variation, out testDataVariation)) { return(testDataVariation.Type); } return(null); }