Example #1
0
        public void From_04_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <RefType?, string, RecordType, StructType, CancellationToken, ValueTask <Guid> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncValueFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
        public void From_14_SourceFuncIsNull_ExpectArgumentNullException()
        {
            var sourceFunc = (Func <int?, object?, RefType?, RefType, StructType, DateTime, int, RecordType, DateTimeKind, RecordType?, object, string, long, object, CancellationToken, ValueTask <RecordType> >)null !;
            var ex         = Assert.Throws <ArgumentNullException>(() => _ = AsyncValueFunc.From(sourceFunc));

            Assert.Equal("funcAsync", ex.ParamName);
        }
        public async ValueTask From_02_ThenInvokeAsync_ExpectResultOfSourceFunc(
            bool?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <RecordType?, StructType, bool?>(
                (_, _, _) => ValueTask.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);
            var actualResult      = await actual.InvokeAsync(MinusFifteenIdNullNameRecord, default, cancellationToken);
        public async ValueTask From_01_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RecordType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <RefType, RecordType?>((_, _) => ValueTask.FromResult(sourceFuncResult));

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

            Assert.Equal(sourceFuncResult, actualResult);
        }
        public async ValueTask From_11_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <StructType, RefType?, long, string, RefType, object, long, DateTimeKind, RefType, object, StructType?, RefType?>(
                (_, _, _, _, _, _, _, _, _, _, _, _) => ValueTask.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);
Example #6
0
        public async ValueTask From_13_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <decimal, StructType, RefType?, RecordType?, long, int, RefType, DateTimeKind, RefType, object?, string, RecordType, string?, RefType>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _, _) => ValueTask.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);
Example #7
0
        public async ValueTask From_04_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <object, int, RecordType?, StructType, RefType?>(
                (_, _, _, _, _) => ValueTask.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: true);

            var actualResult = await actual.InvokeAsync(
                new object(), MinusFifteen, PlusFifteenIdLowerSomeStringNameRecord, default, cancellationToken);
Example #8
0
        public async ValueTask From_00_ThenInvokeAsync_ExpectResultOfSourceFunc(
            string?sourceFuncResult, bool canceled)
        {
            var actual = AsyncValueFunc.From(_ => ValueTask.FromResult(sourceFuncResult));

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

            Assert.Equal(sourceFuncResult, actualResult);
        }
        public async ValueTask From_09_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <RecordType, RefType, int, object?, StructType, string, RecordType?, string?, RefType?, StructType>(
                (_, _, _, _, _, _, _, _, _, _) => ValueTask.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

            var actualResult = await actual.InvokeAsync(
                ZeroIdNullNameRecord, MinusFifteenIdRefType, MinusFifteen, new(), default, SomeString, null, WhiteSpaceString, MinusFifteenIdRefType, cancellationToken);
        public async ValueTask From_08_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <object, RefType?, DateTimeKind, RecordType, int, string, StructType, RecordType, RefType?>(
                (_, _, _, _, _, _, _, _, _) => ValueTask.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);
        public async ValueTask From_06_ThenInvokeAsync_ExpectResultOfSourceFunc(
            string?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <RefType, string, StructType?, object, RecordType, int, string?>(
                (_, _, _, _, _, _, _) => ValueTask.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken();

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

            Assert.Equal(sourceFuncResult, actualResult);
        }
        public async ValueTask From_10_ThenInvokeAsync_ExpectResultOfSourceFunc(
            int?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <object?, StructType?, RefType?, RecordType?, int, string?, long, int?, RefType, StructType?, int?>(
                (_, _, _, _, _, _, _, _, _, _, _) => ValueTask.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);
        }
        public async ValueTask From_14_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <int?, RefType, object?, decimal, RecordType?, StructType, long, RefType, int, DateTimeKind, object, long, RefType, int, StructType>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) => ValueTask.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);
        }
Example #14
0
        public async ValueTask From_07_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RecordType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <string?, int, RefType?, object, RecordType, string, StructType, RecordType?>(
                (_, _, _, _, _, _, _, _) => ValueTask.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);
        }
        public async ValueTask From_03_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <string?, RefType, RecordType?, StructType>(
                (_, _, _, _) => ValueTask.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

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

            Assert.Equal(sourceFuncResult, actualResult);
        }
Example #16
0
        public async ValueTask From_05_ThenInvokeAsync_ExpectResultOfSourceFunc(
            StructType sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <int?, RecordType, RefType?, string, object, StructType>(
                (_, _, _, _, _, _) => ValueTask.FromResult(sourceFuncResult));

            var cancellationToken = new CancellationToken(canceled: false);

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

            Assert.Equal(sourceFuncResult, actualResult);
        }
Example #17
0
        public async ValueTask From_12_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RecordType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <int, object, RecordType?, RefType, object, string?, string, decimal, byte, RecordType, StructType, object, RecordType?>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _) => ValueTask.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);
        }
Example #18
0
        public async ValueTask From_15_ThenInvokeAsync_ExpectResultOfSourceFunc(
            RefType?sourceFuncResult)
        {
            var actual = AsyncValueFunc.From <StructType?, string, long, object?, int, RefType, RecordType, decimal, string?, byte, object, RefType?, object?, decimal?, byte?, RefType?>(
                (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) => ValueTask.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);
        }