forked from haoduotnt/aspnetwebstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultipartMemoryStreamProviderTests.cs
35 lines (29 loc) · 1.21 KB
/
MultipartMemoryStreamProviderTests.cs
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
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.IO;
using System.Net.Http.Headers;
using Microsoft.TestCommon;
namespace System.Net.Http
{
public class MultipartMemoryStreamProviderTests : MultipartStreamProviderTestBase<MultipartMemoryStreamProvider>
{
[Fact]
public void GetStream_ReturnsNewMemoryStream()
{
// Arrange
MultipartMemoryStreamProvider instance = new MultipartMemoryStreamProvider();
HttpContent parent = new StringContent(String.Empty);
HttpContentHeaders headers = FormattingUtilities.CreateEmptyContentHeaders();
// Act
Stream stream1 = instance.GetStream(parent, headers);
Stream stream2 = instance.GetStream(parent, headers);
// Assert
Assert.IsType<MemoryStream>(stream1);
Assert.Equal(0, stream1.Length);
Assert.Equal(0, stream1.Position);
Assert.IsType<MemoryStream>(stream2);
Assert.Equal(0, stream2.Length);
Assert.Equal(0, stream2.Position);
Assert.NotSame(stream1, stream2);
}
}
}