From 26bd01337d60f07058a5352e50deb1609074354e Mon Sep 17 00:00:00 2001 From: Cesar Blum Silveira Date: Thu, 6 Apr 2017 18:49:52 -0700 Subject: [PATCH] Re-write UvStreamHandleTests.ReadStopIsIdempotent without Moq. --- .../UvStreamHandleTests.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/Microsoft.AspNetCore.Server.KestrelTests/UvStreamHandleTests.cs b/test/Microsoft.AspNetCore.Server.KestrelTests/UvStreamHandleTests.cs index d08e8a39f3..0754287832 100644 --- a/test/Microsoft.AspNetCore.Server.KestrelTests/UvStreamHandleTests.cs +++ b/test/Microsoft.AspNetCore.Server.KestrelTests/UvStreamHandleTests.cs @@ -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.KestrelTests.TestHelpers; using Microsoft.AspNetCore.Testing; -using Moq; using Xunit; namespace Microsoft.AspNetCore.Server.KestrelTests @@ -17,15 +16,16 @@ namespace Microsoft.AspNetCore.Server.KestrelTests { var libuvTrace = new LibuvTrace(new TestApplicationErrorLogger()); - var mockUvLoopHandle = new Mock(libuvTrace).Object; - mockUvLoopHandle.Init(new MockLibuv()); + using (var uvLoopHandle = new UvLoopHandle(libuvTrace)) + 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 - var mockUvStreamHandle = new Mock(libuvTrace).Object; - mockUvStreamHandle.Init(mockUvLoopHandle, null); - - mockUvStreamHandle.ReadStop(); - mockUvStreamHandle.ReadStop(); + UvStreamHandle uvStreamHandle = uvTcpHandle; + uvStreamHandle.ReadStop(); + uvStreamHandle.ReadStop(); + } } } -} +} \ No newline at end of file