Re-write UvStreamHandleTests.ReadStopIsIdempotent without Moq.

This commit is contained in:
Cesar Blum Silveira 2017-04-06 18:49:52 -07:00 committed by GitHub
parent a594d0eeb8
commit 26bd01337d
1 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking; using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking;
using Microsoft.AspNetCore.Server.KestrelTests.TestHelpers; using Microsoft.AspNetCore.Server.KestrelTests.TestHelpers;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Moq;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Server.KestrelTests namespace Microsoft.AspNetCore.Server.KestrelTests
@ -17,15 +16,16 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
{ {
var libuvTrace = new LibuvTrace(new TestApplicationErrorLogger()); var libuvTrace = new LibuvTrace(new TestApplicationErrorLogger());
var mockUvLoopHandle = new Mock<UvLoopHandle>(libuvTrace).Object; using (var uvLoopHandle = new UvLoopHandle(libuvTrace))
mockUvLoopHandle.Init(new MockLibuv()); using (var uvTcpHandle = new UvTcpHandle(libuvTrace))
{
uvLoopHandle.Init(new MockLibuv());
uvTcpHandle.Init(uvLoopHandle, null);
// Need to mock UvTcpHandle instead of UvStreamHandle, since the latter lacks an Init() method UvStreamHandle uvStreamHandle = uvTcpHandle;
var mockUvStreamHandle = new Mock<UvTcpHandle>(libuvTrace).Object; uvStreamHandle.ReadStop();
mockUvStreamHandle.Init(mockUvLoopHandle, null); uvStreamHandle.ReadStop();
}
mockUvStreamHandle.ReadStop();
mockUvStreamHandle.ReadStop();
} }
} }
} }