public async Task LoadTwoAsync()
        {
            // arrange
            var dataLoader = new CustomBatchDataLoader(
                new DelayDispatcher(),
                new DataLoaderOptions());

            // act
            Task <string[]> result1 = dataLoader.LoadAsync("1abc");
            Task <string[]> result2 = dataLoader.LoadAsync("0abc");

            // assert
            Assert.Collection(await result1, t => Assert.Equal("Value:1abc", t));
            Assert.Collection(await result2, t => Assert.Equal("Value:0abc", t));
        }
Esempio n. 2
0
        public async Task LoadTheSameKeyTwiceWillYieldSamePromise()
        {
            // arrange
            var dataLoader = new CustomBatchDataLoader(
                new DelayDispatcher(),
                new DataLoaderOptions());

            // act
            Task <string> result1 = dataLoader.LoadAsync("1abc");
            Task <string> result2 = dataLoader.LoadAsync("1abc");

            // assert
            Assert.Same(result1, result2);
            Assert.Equal("Value:1abc", await result1);
            Assert.Equal("Value:1abc", await result2);
        }
Esempio n. 3
0
        public async Task LoadSingleAsync()
        {
            // arrange
            var dataLoader = new CustomBatchDataLoader(
                new DataLoaderOptions());

            // act
            var result = await dataLoader.LoadAsync("abc");

            // assert
            Assert.Equal("Value:abc", result);
        }
        public async Task LoadSingleAsync()
        {
            // arrange
            var dataLoader = new CustomBatchDataLoader(
                new AutoBatchScheduler(),
                new DataLoaderOptions());

            // act
            var result = await dataLoader.LoadAsync("abc");

            // assert
            Assert.Collection(result, t => Assert.Equal("Value:abc", t));
        }