ALinq.Tests.AsyncEnumerableCastTests.CastShouldThrowInvalidCastExceptionForOtherTypesContained C# (CSharp) 메소드

CastShouldThrowInvalidCastExceptionForOtherTypesContained() 개인적인 메소드

private CastShouldThrowInvalidCastExceptionForOtherTypesContained ( ) : System.Threading.Tasks.Task
리턴 System.Threading.Tasks.Task
        public async Task CastShouldThrowInvalidCastExceptionForOtherTypesContained()
        {
#pragma warning disable 1998
            var sequence = AsyncEnumerable.Range(0, 100).Cast<object>().Concat(AsyncEnumerable.Range(0, 100).Select(async i => i.ToString()));
#pragma warning restore 1998

            try
            {
                await sequence.Cast<string>().ToList();
                Assert.Fail("No exception thrown");
            }
            catch (AggregateException ex)
            {
               Assert.IsInstanceOfType(ex.InnerException,typeof(InvalidCastException));
            }
        }
    }