Using [NotNull]
This commit is contained in:
parent
018b4c2426
commit
4852bf0c52
|
|
@ -12,6 +12,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.FeatureModel;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.TestHost
|
||||
{
|
||||
|
|
@ -28,13 +29,8 @@ namespace Microsoft.AspNet.TestHost
|
|||
/// Create a new handler.
|
||||
/// </summary>
|
||||
/// <param name="next">The pipeline entry point.</param>
|
||||
public ClientHandler(Func<IFeatureCollection, Task> next, PathString pathBase)
|
||||
public ClientHandler([NotNull] Func<IFeatureCollection, Task> next, PathString pathBase)
|
||||
{
|
||||
if (next == null)
|
||||
{
|
||||
throw new ArgumentNullException("next");
|
||||
}
|
||||
|
||||
_next = next;
|
||||
|
||||
// PathString.StartsWithSegments that we use below requires the base path to not end in a slash.
|
||||
|
|
@ -53,14 +49,9 @@ namespace Microsoft.AspNet.TestHost
|
|||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
protected override async Task<HttpResponseMessage> SendAsync(
|
||||
HttpRequestMessage request,
|
||||
[NotNull] HttpRequestMessage request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
var state = new RequestState(request, _pathBase, cancellationToken);
|
||||
var requestContent = request.Content ?? new StreamContent(Stream.Null);
|
||||
var body = await requestContent.ReadAsStreamAsync();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.TestHost
|
||||
{
|
||||
|
|
@ -26,13 +27,8 @@ namespace Microsoft.AspNet.TestHost
|
|||
/// <param name="server"></param>
|
||||
/// <param name="path"></param>
|
||||
[SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Not a full URI")]
|
||||
public RequestBuilder(TestServer server, string path)
|
||||
public RequestBuilder([NotNull] TestServer server, string path)
|
||||
{
|
||||
if (server == null)
|
||||
{
|
||||
throw new ArgumentNullException("server");
|
||||
}
|
||||
|
||||
_server = server;
|
||||
_req = new HttpRequestMessage(HttpMethod.Get, path);
|
||||
}
|
||||
|
|
@ -42,13 +38,8 @@ namespace Microsoft.AspNet.TestHost
|
|||
/// </summary>
|
||||
/// <param name="configure"></param>
|
||||
/// <returns></returns>
|
||||
public RequestBuilder And(Action<HttpRequestMessage> configure)
|
||||
public RequestBuilder And([NotNull] Action<HttpRequestMessage> configure)
|
||||
{
|
||||
if (configure == null)
|
||||
{
|
||||
throw new ArgumentNullException("configure");
|
||||
}
|
||||
|
||||
configure(_req);
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Diagnostics.Contracts;
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.TestHost
|
||||
{
|
||||
|
|
@ -28,12 +29,8 @@ namespace Microsoft.AspNet.TestHost
|
|||
private Action _onFirstWrite;
|
||||
private bool _firstWrite;
|
||||
|
||||
internal ResponseStream(Action onFirstWrite)
|
||||
internal ResponseStream([NotNull] Action onFirstWrite)
|
||||
{
|
||||
if (onFirstWrite == null)
|
||||
{
|
||||
throw new ArgumentNullException("onFirstWrite");
|
||||
}
|
||||
_onFirstWrite = onFirstWrite;
|
||||
_firstWrite = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
"version": "1.0.0-*",
|
||||
"description": "ASP.NET 5 web server for writing and running tests.",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Hosting": "1.0.0-*"
|
||||
"Microsoft.AspNet.Hosting": "1.0.0-*",
|
||||
"Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue