Ejemplo n.º 1
0
        public void From_13_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <long, RecordType, string?, object?, RecordType?, object?, RecordType, DateTimeOffset, object, DateTimeKind, string, int, RecordType?, CancellationToken, Task <long> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
Ejemplo n.º 2
0
        public void From_07_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <RecordType, string, RefType?, object, Guid?, int, StructType, CancellationToken, Task <int> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
Ejemplo n.º 3
0
        public void From_11_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <RecordType?, string, StructType, long?, object, DateTimeKind, RefType?, decimal, object, RecordType, byte, CancellationToken, Task <DateTime> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
Ejemplo n.º 4
0
        public void From_00_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <CancellationToken, Task <StructType> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
Ejemplo n.º 5
0
        public void From_08_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <DateTimeOffset, object, RefType?, Guid, RecordType, StructType?, string, long, CancellationToken, Task <RecordType?> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
Ejemplo n.º 6
0
        public void From_12_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <string, int, decimal?, object?, RefType, StructType?, DateTime?, RecordType, int, StructType, object?, string?, CancellationToken, Task <RefType?> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
Ejemplo n.º 7
0
        public async Task From_02_ThenInvokeAsync_ExpectResultOfSourceFunc(
            bool?sourceFuncResult)
        {
            var actual = AsyncFunc.From <RecordType?, StructType, bool?>(
                (_, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);
            var actualResult      = await actual.InvokeAsync(MinusFifteenIdNullNameRecord, default, cancellationToken);
Ejemplo n.º 8
0
        public async Task From_09_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncFunc.From <RecordType, RefType, int, object?, StructType, string, RecordType?, string?, RefType?, StructType>(
                (_, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                ZeroIdNullNameRecord, MinusFifteenIdRefType, MinusFifteen, new(), default, SomeString, null, WhiteSpaceString, MinusFifteenIdRefType, cancellationToken);
Ejemplo n.º 9
0
        public async Task From_13_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType sourceFuncResult)
        {
            var actual = AsyncFunc.From <decimal, StructType, RefType?, RecordType?, long, int, RefType, DateTimeKind, RefType, object?, string, RecordType, string?, RefType>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                decimal.One, SomeTextStructType, PlusFifteenIdRefType, ZeroIdNullNameRecord, default, default, MinusFifteenIdRefType, DateTimeKind.Unspecified, null !, new(), ThreeWhiteSpacesString, MinusFifteenIdNullNameRecord, EmptyString, cancellationToken);
Ejemplo n.º 10
0
        public async Task From_04_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <object, int, RecordType?, StructType, RefType?>(
                (_, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);

            var actualResult = await actual.InvokeAsync(
                new object(), MinusFifteen, PlusFifteenIdLowerSomeStringNameRecord, default, cancellationToken);
Ejemplo n.º 11
0
        public async Task From_08_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <object, RefType?, DateTimeKind, RecordType, int, string, StructType, RecordType, RefType?>(
                (_, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                new { Id = PlusFifteen }, default, DateTimeKind.Local, PlusFifteenIdLowerSomeStringNameRecord, MinusFifteen, null !, SomeTextStructType, MinusFifteenIdSomeStringNameRecord, cancellationToken);
Ejemplo n.º 12
0
        public async Task From_00_ThenInvokeAsync_ExpectResultOfSourceFunc(
            string?sourceFuncResult, bool canceled)
        {
            var actual = AsyncFunc.From(_ => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: canceled);
            var actualResult      = await actual.InvokeAsync(cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 13
0
        public async Task From_01_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RecordType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <RefType, RecordType?>((_, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = default(CancellationToken);
            var actualResult      = await actual.InvokeAsync(PlusFifteenIdRefType, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 14
0
        public async Task From_11_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <StructType, RefType?, long, string, RefType, object, long, DateTimeKind, RefType, object, StructType?, RefType?>(
                (_, _, _, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);

            var actualResult = await actual.InvokeAsync(
                LowerSomeTextStructType, default, long.MaxValue, UpperSomeString, PlusFifteenIdRefType, null !, long.MinValue, DateTimeKind.Utc, null !, MinusFifteenIdRefType, SomeTextStructType, cancellationToken);
Ejemplo n.º 15
0
        public async Task From_03_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncFunc.From <string?, RefType, RecordType?, StructType>(
                (_, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                LowerSomeString, ZeroIdRefType, PlusFifteenIdLowerSomeStringNameRecord, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 16
0
        public async Task From_07_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RecordType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <string?, int, RefType?, object, RecordType, string, StructType, RecordType?>(
                (_, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);

            var actualResult = await actual.InvokeAsync(
                SomeString, PlusFifteen, MinusFifteenIdRefType, SomeTextStructType, null !, EmptyString, LowerSomeTextStructType, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 17
0
        public async Task From_06_ThenInvokeAsync_ExpectResultOfSourceFunc(
            string?sourceFuncResult)
        {
            var actual = AsyncFunc.From <RefType, string, StructType?, object, RecordType, int, string?>(
                (_, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken();

            var actualResult = await actual.InvokeAsync(
                MinusFifteenIdRefType, null !, new(), new(), PlusFifteenIdLowerSomeStringNameRecord, int.MaxValue, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 18
0
        public async Task From_05_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncFunc.From <int?, RecordType, RefType?, string, object, StructType>(
                (_, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                MinusFifteen, PlusFifteenIdSomeStringNameRecord, null, SomeString, new(), cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 19
0
        public async Task From_10_ThenInvokeAsync_ExpectResultOfSourceFunc(
            int?sourceFuncResult)
        {
            var actual = AsyncFunc.From <object?, StructType?, RefType?, RecordType?, int, string?, long, int?, RefType, StructType?, int?>(
                (_, _, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = default(CancellationToken);

            var actualResult = await actual.InvokeAsync(
                null, SomeTextStructType, PlusFifteenIdRefType, MinusFifteenIdSomeStringNameRecord, MinusFifteen, TabString, long.MinValue, Zero, MinusFifteenIdRefType, LowerSomeTextStructType, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 20
0
        public async Task From_12_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RecordType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <int, object, RecordType?, RefType, object, string?, string, decimal, byte, RecordType, StructType, object, RecordType?>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);

            var actualResult = await actual.InvokeAsync(
                PlusFifteen, new { Name = UpperSomeString }, null, PlusFifteenIdRefType, null !, SomeString, EmptyString, decimal.MinusOne, byte.MaxValue, MinusFifteenIdSomeStringNameRecord, LowerSomeTextStructType, SomeTextStructType, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 21
0
        public async Task From_15_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncFunc.From <StructType?, string, long, object?, int, RefType, RecordType, decimal, string?, byte, object, RefType?, object?, decimal?, byte?, RefType?>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);

            var actualResult = await actual.InvokeAsync(
                LowerSomeTextStructType, SomeString, long.MaxValue, null, MinusFifteen, PlusFifteenIdRefType, PlusFifteenIdLowerSomeStringNameRecord, decimal.One, ThreeWhiteSpacesString, byte.MaxValue, new { Name = SomeString }, ZeroIdRefType, new(), decimal.MaxValue, null, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }
Ejemplo n.º 22
0
        public async Task From_14_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncFunc.From <int?, RefType, object?, decimal, RecordType?, StructType, long, RefType, int, DateTimeKind, object, long, RefType, int, StructType>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) => Task.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                PlusFifteen, MinusFifteenIdRefType, new(), decimal.MinusOne, MinusFifteenIdSomeStringNameRecord, SomeTextStructType, long.MinValue, PlusFifteenIdRefType, int.MaxValue, DateTimeKind.Utc, null !, long.MinValue, MinusFifteenIdRefType, int.MinValue, cancellationToken);

            Assert.Equal(sourceFuncResult, actualResult);
        }