public static IEnumerable <TTarget> DynamicMap <TTarget>(this IEnumerable sources) where TTarget : class, new() { if (sources == null) { return(null); } var sourceItemType = sources.GetType().GetEnumerableItemType(); Should.NotNull(sourceItemType, () => new InvalidOperationException($"can not judge source item type, source should be generic type '{typeof(IEnumerable<>)}'.")); return(Invoke <IEnumerable <TTarget> >(sourceItemType, typeof(TTarget), "map-enumerable", sources)); }
public void ShouldThrowExceptionWhenNotNullCheckNullValue() { var action = new Action(() => Should.NotNull(null, () => new InvalidOperationException())); action.Should().Throw <InvalidOperationException>(); }
public void ShouldNotThrowExceptionWhenNotNullCheckNotNullValue() { Should.NotNull("", () => new CodeException()); Should.NotNull(1, () => new CodeException()); Should.NotNull(new object(), () => new CodeException()); }
public void ShouldThrowExceptionWhenNotNullCheckNullValue() { Should.NotNull(null, () => new InvalidOperationException()); }