示例#1
0
        public async Task CastWithDoubleResultNullSourceThrowsArgumentNullExceptionTest()
        {
            // 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.Cast <double>(asyncSource).ToListAsync().ConfigureAwait(false);
            });
        }
示例#2
0
        public async Task CastWithNullableDecimalResultIsEquivalentToCastTest()
        {
            // Arrange

            // Arrange 'queryAdapter' parameter
            var queryAdapter = await GetQueryAdapterAsync(DisallowAll);

            // Arrange 'source' parameter
            var source = GetQueryable <decimal?>().Select(p => (object)p);

            // Arrange 'asyncSource' parameter
            var asyncSource = queryAdapter.GetAsyncQueryable <decimal?>().Select(p => (object)p);

            // Arrange 'expectedResult' parameter
            var expectedResult = Enumerable.Cast <decimal?>(source);

            // Act
            var result = await AsyncQueryable.Cast <decimal?>(asyncSource).ToListAsync().ConfigureAwait(false);

            // Assert
            Assert.Equal(expectedResult, result);
        }