public void WhenAdaptManyDoesNotReturnNull_ReturnsResultFromAdaptMany() { A.CallTo(() => _testAdapter.Adapt(A <DateTime> ._)).Returns(true); var expected = _sampleInput.Select(str => true); _testAdapter.AdaptMany(_sampleInput).Should().BeEquivalentTo(expected); }
public void GivenNullAdapter_Throws() { _testAdapter = null; Action act = () => _testAdapter.AdaptMany(_sampleInput); act.Should().Throw <ArgumentNullException>(); }
public static IEnumerable <TOut> AdaptManyOrFallback <TIn, TOut>(this IAdapter <TIn, TOut> adapter, IEnumerable <TIn> input, Func <IEnumerable <TOut> > nullFallbackProvider) { if (adapter == null) { throw new ArgumentNullException(nameof(adapter)); } return(adapter.AdaptMany(input) ?? nullFallbackProvider()); }
public void GivenNullEnumerable_ReturnsNull() { _testAdapter.AdaptMany(null).Should().BeNull(); }