public async Task OfTypeWithDoubleResultNullSourceThrowsArgumentNullExceptionTest() { // Arrange // Arrange 'queryAdapter' parameter var queryAdapter = await GetQueryAdapterAsync(DisallowAll); // Arrange 'asyncSource' parameter IAsyncQueryable <object> asyncSource = null !; // Act // - // Assert await Assert.ThrowsAsync <ArgumentNullException>(async() => { await AsyncQueryable.OfType <double>(asyncSource).ToListAsync().ConfigureAwait(false); }); }
public async Task OfTypeWithInt32ResultIsEquivalentToOfTypeTest() { // Arrange // Arrange 'queryAdapter' parameter var queryAdapter = await GetQueryAdapterAsync(DisallowAll); // Arrange 'source' parameter var sourcePart1 = GetQueryable <double>().Select(p => (object)p); var sourcePart2 = GetQueryable <decimal?>().Select(p => (object)p); var sourcePart3 = GetQueryable <float?>().Select(p => (object)p); var sourcePart4 = GetQueryable <double?>().Select(p => (object)p); var sourcePart5 = GetQueryable <decimal>().Select(p => (object)p); var sourcePart6 = GetQueryable <float>().Select(p => (object)p); var sourcePart7 = GetQueryable <long?>().Select(p => (object)p); var sourcePart8 = GetQueryable <int?>().Select(p => (object)p); var sourcePart9 = GetQueryable <long>().Select(p => (object)p); var sourcePart10 = GetQueryable <int>().Select(p => (object)p); var source = sourcePart1.Concat(sourcePart2).Concat(sourcePart3).Concat(sourcePart4).Concat(sourcePart5).Concat(sourcePart6).Concat(sourcePart7).Concat(sourcePart8).Concat(sourcePart9).Concat(sourcePart10); // Arrange 'asyncSource' parameter var asyncSourcePart1 = queryAdapter.GetAsyncQueryable <double>().Select(p => (object)p); var asyncSourcePart2 = queryAdapter.GetAsyncQueryable <decimal?>().Select(p => (object)p); var asyncSourcePart3 = queryAdapter.GetAsyncQueryable <float?>().Select(p => (object)p); var asyncSourcePart4 = queryAdapter.GetAsyncQueryable <double?>().Select(p => (object)p); var asyncSourcePart5 = queryAdapter.GetAsyncQueryable <decimal>().Select(p => (object)p); var asyncSourcePart6 = queryAdapter.GetAsyncQueryable <float>().Select(p => (object)p); var asyncSourcePart7 = queryAdapter.GetAsyncQueryable <long?>().Select(p => (object)p); var asyncSourcePart8 = queryAdapter.GetAsyncQueryable <int?>().Select(p => (object)p); var asyncSourcePart9 = queryAdapter.GetAsyncQueryable <long>().Select(p => (object)p); var asyncSourcePart10 = queryAdapter.GetAsyncQueryable <int>().Select(p => (object)p); var asyncSource = asyncSourcePart1.Concat(asyncSourcePart2).Concat(asyncSourcePart3).Concat(asyncSourcePart4).Concat(asyncSourcePart5).Concat(asyncSourcePart6).Concat(asyncSourcePart7).Concat(asyncSourcePart8).Concat(asyncSourcePart9).Concat(asyncSourcePart10); // Arrange 'expectedResult' parameter var expectedResult = Enumerable.OfType <int>(source); // Act var result = await AsyncQueryable.OfType <int>(asyncSource).ToListAsync().ConfigureAwait(false); // Assert Assert.Equal(expectedResult, result); }