Пример #1
0
            public void WhenAdaptManyDoesNotReturnNull_ReturnsResultFromAdaptMany()
            {
                A.CallTo(() => _testAdapter.Adapt(A <DateTime> ._)).Returns(true);
                var expected = _sampleInput.Select(str => true);

                _testAdapter.AdaptMany(_sampleInput).Should().BeEquivalentTo(expected);
            }
Пример #2
0
            public void GivenNullAdapter_Throws()
            {
                _testAdapter = null;
                Action act = () => _testAdapter.AdaptMany(_sampleInput);

                act.Should().Throw <ArgumentNullException>();
            }
Пример #3
0
 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());
 }
Пример #4
0
 public void GivenNullEnumerable_ReturnsNull()
 {
     _testAdapter.AdaptMany(null).Should().BeNull();
 }