Пример #1
0
        public void FetchOnceAsync_1_ContextNull_ArgNullException()
        {
            // arrange
            // assert
            Action a = () => DataLoaderResolverContextExtensions
                       .FetchOnceAsync(
                null,
                "abc",
                new FetchOnce <string>(() => Task.FromResult(string.Empty)));

            // act
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #2
0
        public void FetchOnceAsync_1_ContextNull_ArgNullException()
        {
            // arrange
            // assert
            Action a = () => DataLoaderResolverContextExtensions
                       .FetchOnceAsync(
                null,
                new Func <CancellationToken, Task <string> >(ct =>
                                                             Task.FromResult(string.Empty)),
                key: "abc");

            // act
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #3
0
        public void CacheDataLoader_2_ContextNull_ArgNullException()
        {
            // arrange
            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .CacheDataLoader(
                null,
                "abc",
                new FetchCacheCt <string, string>((keys, ct) =>
                                                  Task.FromResult(string.Empty)));

            // assert
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #4
0
        public void BatchDataLoader_2_FetchNull_ArgNullException()
        {
            // arrange
            var resolverContext = new Mock <IResolverContext>();

            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .BatchDataLoader(
                resolverContext.Object,
                "123",
                default(FetchBatch <string, string>));

            // assert
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #5
0
        public void FetchOnceAsync_2_FetchNull_ArgNullException()
        {
            // arrange
            var resolverContext = new Mock <IResolverContext>();

            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .FetchOnceAsync(
                resolverContext.Object,
                "123",
                default(Func <CancellationToken, Task <string> >));

            // assert
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #6
0
        public void BatchDataLoader_2_ContextNull_ArgNullException()
        {
            // arrange
            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .BatchDataLoader(
                null,
                "abc",
                new FetchBatch <string, string>((keys, ct) => Task
                                                .FromResult <IReadOnlyDictionary <string, string> >(
                                                    null)));

            // assert
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #7
0
        public void CacheDataLoader_1_FetchNull_ArgNullException()
        {
            // arrange
            var resolverContext = new Mock <IResolverContext>();

            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .CacheDataLoader(
                resolverContext.Object,
                default(FetchCacheCt <string, string>),
                key: "123");

            // assert
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #8
0
        public void FetchOnceAsync_1_KeyNull_ArgNullException()
        {
            // arrange
            var resolverContext = new Mock <IResolverContext>();

            // assert
            Action a = () => DataLoaderResolverContextExtensions
                       .FetchOnceAsync(
                resolverContext.Object,
                null,
                new FetchOnce <string>(() => Task.FromResult(string.Empty)));

            // act
            Assert.Throws <ArgumentException>(a);
        }
Пример #9
0
        public void CacheDataLoader_2_KeyNull_ArgNullException()
        {
            // arrange
            var resolverContext = new Mock <IResolverContext>();

            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .CacheDataLoader(
                resolverContext.Object,
                null,
                new FetchCacheCt <string, string>((keys, ct) =>
                                                  Task.FromResult(string.Empty)));

            // assert
            Assert.Throws <ArgumentException>(a);
        }
Пример #10
0
        public void GroupDataLoader_2_ContextNull_ArgNullException()
        {
            // arrange
            var lookup = new Mock <ILookup <string, string> >();

            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .GroupDataLoader(
                null,
                "abc",
                new FetchGroup <string, string>((keys, ct) =>
                                                Task.FromResult(lookup.Object)));

            // assert
            Assert.Throws <ArgumentNullException>(a);
        }
Пример #11
0
        public void BatchDataLoader_2_KeyNull_ArgNullException()
        {
            // arrange
            var resolverContext = new Mock <IResolverContext>();

            // act
            Action a = () => DataLoaderResolverContextExtensions
                       .BatchDataLoader(
                resolverContext.Object,
                null,
                new FetchBatch <string, string>((keys, ct) => Task
                                                .FromResult <IReadOnlyDictionary <string, string> >(
                                                    null)));

            // assert
            Assert.Throws <ArgumentException>(a);
        }