public void And_they_start_non_pollable() { We_can_get_a_Recv_FD(fd => { var @in = In.ToShort(); Section("they start non pollable", () => { var x = new POLLFD((ushort)fd, @in, 0); Assert.Equal(0, WsaPoll(ref x, 1, 0)); Assert.Equal(0, x.Revents); }); }); }
public void When_we_write_they_are_pollable() { We_can_get_a_Recv_FD(fd => { var @in = In.ToShort(); var rdNorm = ReaddNormal.ToShort(); Section("when we write they are pollable", () => { var s2 = _sockets[1]; var x = new POLLFD((ushort)fd, In.ToShort(), 0); using (var m = CreateMessage()) { m.Body.Append(Kick); s2.Send(m); Assert.Equal(1, WsaPoll(ref x, 1, 1000)); // The C/C++ unit test are actually more specific than the original unit test suggests. Assert.NotEqual(0, x.Revents & @in); Assert.Equal(rdNorm, x.Revents & @in); } }); }); }
private static extern int WsaPoll(ref POLLFD value, ulong fds, int timeout);