예제 #1
0
        public async Task LoadIntoBufferAsync_ContentLengthSmallerThanActualData_ActualDataLargerThanMaxSize_ThrowsException(
            int numberOfWrites, int sizeOfEachWrite, int reportedLength, int maxSize)
        {
            Assert.InRange(maxSize, 1, (numberOfWrites * sizeOfEachWrite) - 1);

            LieAboutLengthContent c = new LieAboutLengthContent(numberOfWrites, sizeOfEachWrite, reportedLength);
            Task t = c.LoadIntoBufferAsync(maxSize);
            await Assert.ThrowsAsync <HttpRequestException>(() => t);
        }
예제 #2
0
        public async Task LoadIntoBufferAsync_ContentLengthSmallerThanActualData_ActualDataLargerThanMaxSize_ThrowsException(
            int numberOfWrites, int sizeOfEachWrite, int reportedLength, int maxSize)
        {
            Assert.InRange(maxSize, 1, (numberOfWrites * sizeOfEachWrite) - 1);

            LieAboutLengthContent c = new LieAboutLengthContent(numberOfWrites, sizeOfEachWrite, reportedLength);
            Task t = c.LoadIntoBufferAsync(maxSize);
            await Assert.ThrowsAsync<HttpRequestException>(() => t);
        }