Re-write UvStreamHandleTests.ReadStopIsIdempotent without Moq.
This commit is contained in:
parent
a594d0eeb8
commit
26bd01337d
|
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue