Add micro `FormReader` stress test.

This commit is contained in:
N. Taylor Mullen 2015-09-08 12:25:18 -07:00
Родитель 86bfdd7fe7
Коммит e1e7e298e2
2 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -1,7 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.StressFramework;
using Microsoft.AspNet.WebUtilities;
using Xunit;
namespace Microsoft.AspNet.Stress.Tests
@ -13,5 +18,32 @@ namespace Microsoft.AspNet.Stress.Tests
{
Assert.True(true);
}
[StressTest]
public async Task SmokeyHttpAbstractionsSmokeTest()
{
// Arrange
var formData = "first=second&third=fourth&fifth=sixth";
var formReader = new FormReader(formData);
var pairs = new List<KeyValuePair<string, string>>();
var cancellationToken = new CancellationToken();
var expectedPairs = new Dictionary<string, string>
{
{ "first", "second" },
{ "third", "fourth" },
{ "fifth", "sixth" },
}.ToList();
// Act
var pair = await formReader.ReadNextPairAsync(cancellationToken);
while (pair != null)
{
pairs.Add(pair.Value);
pair = await formReader.ReadNextPairAsync(cancellationToken);
}
// Assert
Assert.Equal(expectedPairs, pairs);
}
}
}

Просмотреть файл

@ -4,7 +4,8 @@
"test": "xunit.runner.aspnet"
},
"dependencies": {
"Microsoft.AspNet.StressFramework": ""
"Microsoft.AspNet.StressFramework": "",
"Microsoft.AspNet.WebUtilities": "1.0.0-*"
},
"frameworks": {
"dnx451": { },