forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultipartStreamProviderTestBase.cs
More file actions
61 lines (49 loc) · 1.76 KB
/
Copy pathMultipartStreamProviderTestBase.cs
File metadata and controls
61 lines (49 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// 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.ObjectModel;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.TestCommon;
namespace System.Net.Http
{
public abstract class MultipartStreamProviderTestBase<TProvider> where TProvider : MultipartStreamProvider, new()
{
protected MultipartStreamProviderTestBase()
{
}
[Fact]
public void Contents_IsEmpty()
{
// Arrange
TProvider provider = new TProvider();
// Act
Collection<HttpContent> contents = provider.Contents;
// Assert
Assert.Empty(contents);
}
[Fact]
public void PostProcessing_ReturnsCompleteTask()
{
// Arrange
TProvider provider = new TProvider();
// Act
Task postProcessing = provider.ExecutePostProcessingAsync();
// Assert
Assert.Equal(TaskStatus.RanToCompletion, postProcessing.Status);
}
[Fact]
public void GetStream_ThrowsOnNullParent()
{
TProvider provider = new TProvider();
HttpContentHeaders headers = FormattingUtilities.CreateEmptyContentHeaders();
Assert.ThrowsArgumentNull(() => provider.GetStream(null, headers), "parent");
}
[Fact]
public void GetStream_ThrowsOnNullHeaders()
{
TProvider provider = new TProvider();
StringContent content = new StringContent(String.Empty);
Assert.ThrowsArgumentNull(() => provider.GetStream(content, null), "headers");
}
}
}