Exemplo n.º 1
0
        public async Task Return_Null_on_Null_Streams()
        {
            var pagingService = new ODataPagingService();

            var response = await pagingService.MergeJsonStreamsAsync(null, null);

            Assert.Null(response);
        }
Exemplo n.º 2
0
        public async Task Return_Right_on_Null_Left_Stream()
        {
            var pagingService = new ODataPagingService();

            using var ms = new MemoryStream(Encoding.UTF8.GetBytes("{\"value\": [20]}"));
            var response = await pagingService.MergeJsonStreamsAsync(null, ms);

            Assert.Equal(ms, response);
        }
Exemplo n.º 3
0
        public async Task Return_Left_On_Null_Data_In_Right_Stream()
        {
            var pagingService = new ODataPagingService();

            using var leftMs  = new MemoryStream(Encoding.UTF8.GetBytes("{\"value\": [20]}"));
            using var rightMs = new MemoryStream(Encoding.UTF8.GetBytes("{\"value\": null}"));
            var response = await pagingService.MergeJsonStreamsAsync(leftMs, rightMs);

            using var reader = new StreamReader(response ?? Stream.Null);
            var result = await reader.ReadToEndAsync();

            Assert.Equal("{\"value\": [20]}", result);
        }
Exemplo n.º 4
0
        public async Task Return_With_Next_Link_From_Right_Stream(string left, string right, string expected)
        {
            var pagingService = new ODataPagingService();

            using var leftMs  = new MemoryStream(Encoding.UTF8.GetBytes(left));
            using var rightMs = new MemoryStream(Encoding.UTF8.GetBytes(right));
            var response = await pagingService.MergeJsonStreamsAsync(leftMs, rightMs);

            using var reader = new StreamReader(response ?? Stream.Null);
            var result = await reader.ReadToEndAsync();

            Assert.Equal(expected, result);
        }