}
}
+ internal long? LoadedBufferLength {
+ get {
+ return buffer == null ? (long?)null : buffer.Length;
+ }
+ }
+
public Task CopyToAsync (Stream stream)
{
return CopyToAsync (stream, null);
}
}
+ class CannotSeekStream : MemoryStream
+ {
+ public CannotSeekStream ()
+ : base (new byte [11])
+ {
+ }
+
+ public override bool CanSeek {
+ get {
+ return false;
+ }
+ }
+ }
+
[Test]
public void Ctor_Invalid ()
{
Assert.AreEqual (0, stream_read.Position, "#3");
Assert.AreEqual (1, stream_read.Length, "#4");
}
+
+ [Test]
+ public void ContentLengthAfterLoad ()
+ {
+ var sc = new StreamContent (new CannotSeekStream ());
+ Assert.IsTrue (sc.LoadIntoBufferAsync ().Wait (3000), "#1");
+ Assert.AreEqual (11, sc.Headers.ContentLength, "#2");
+ }
}
}