Beispiel #1
0
 /// <summary>
 /// Verifies the <paramref name="parameter"/> in the <paramref name="expectedValues"/>
 /// and <paramref name="precision"/>, <paramref name="itemType"/> and that it
 /// <paramref name="rendered"/> correctly.
 /// </summary>
 /// <param name="parameter"></param>
 /// <param name="expectedValues"></param>
 /// <param name="precision"></param>
 /// <param name="itemType"></param>
 /// <param name="rendered"></param>
 private static void VerifyRepeatedParameter(IRepeatedParameter <double> parameter, IEnumerable <double> expectedValues, int precision, Type itemType, string rendered)
 => parameter.AssertNotNull()
 .AssertEqual(itemType.AssertNotNull(), x => x.ItemType)
 .AssertEqual(rendered.AssertNotNull().AssertCollectionNotEmpty(), x => x.ToString())
 .AssertEqual(expectedValues.Count(), x => x.Value.Count)
 .Value.Zip(expectedValues, (x, y) => new { X = x, Y = y })
 .ToList().ForEach(zipped => zipped.X.AssertEqual(zipped.Y, precision));
 /// <inheritdoc />
 internal RepeatedTestCaseDescriptor(IRepeatedParameter <T> instance, string parameterName)
     : base(instance)
 {
     Instance  = instance;
     ItemType  = typeof(T);
     ValueType = typeof(ICollection <T>);
     Rendered  = $"{parameterName}{Colon} {RenderRepeatedValues(instance?.Value?.ToArray())}";
 }
Beispiel #3
0
 /// <summary>
 /// Returns a strongly typed instance of the Repeated Descriptor.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="instance"></param>
 /// <param name="parameterName"></param>
 /// <returns></returns>
 internal static TestCaseDescriptor CreateRepeated <T>(IRepeatedParameter <T> instance, string parameterName)
     where T : IComparable
 => new RepeatedTestCaseDescriptor <T>(instance, parameterName);