Skip to content

Commit a416361

Browse files
committed
Fix unit tests
1 parent 60ef090 commit a416361

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/NetMQ.Tests/MsgTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void Constructor()
2525
Assert.False(msg.IsDelimiter);
2626
Assert.False(msg.IsIdentity);
2727
Assert.False(msg.IsInitialised);
28-
Assert.Throws<NullReferenceException>(() => msg[0] = 1);
28+
Assert.ThrowsAny<Exception>(() => msg[0] = 1);
2929
Assert.Throws<FaultException>((Action)msg.Close);
3030
}
3131

src/NetMQ/Monitoring/NetMQMonitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private void Handle(object sender, NetMQSocketEventArgs socketEventArgs)
164164
InvokeEvent(Connected, new NetMQMonitorSocketEventArgs(this, monitorEvent.Addr, GetArg<AsyncSocket>(), SocketEvents.Connected));
165165
break;
166166
case SocketEvents.ConnectDelayed:
167-
InvokeEvent(ConnectDelayed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, GetArg<ErrorCode>(), SocketEvents.ConnectDelayed));
167+
InvokeEvent(ConnectDelayed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, (ErrorCode)GetArg<int>(), SocketEvents.ConnectDelayed));
168168
break;
169169
case SocketEvents.ConnectRetried:
170170
InvokeEvent(ConnectRetried, new NetMQMonitorIntervalEventArgs(this, monitorEvent.Addr, GetArg<int>(), SocketEvents.ConnectRetried));
@@ -173,19 +173,19 @@ private void Handle(object sender, NetMQSocketEventArgs socketEventArgs)
173173
InvokeEvent(Listening, new NetMQMonitorSocketEventArgs(this, monitorEvent.Addr, GetArg<AsyncSocket>(), SocketEvents.Listening));
174174
break;
175175
case SocketEvents.BindFailed:
176-
InvokeEvent(BindFailed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, GetArg<ErrorCode>(), SocketEvents.BindFailed));
176+
InvokeEvent(BindFailed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, (ErrorCode)GetArg<int>(), SocketEvents.BindFailed));
177177
break;
178178
case SocketEvents.Accepted:
179179
InvokeEvent(Accepted, new NetMQMonitorSocketEventArgs(this, monitorEvent.Addr, GetArg<AsyncSocket>(), SocketEvents.Accepted));
180180
break;
181181
case SocketEvents.AcceptFailed:
182-
InvokeEvent(AcceptFailed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, GetArg<ErrorCode>(), SocketEvents.AcceptFailed));
182+
InvokeEvent(AcceptFailed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, (ErrorCode)GetArg<int>(), SocketEvents.AcceptFailed));
183183
break;
184184
case SocketEvents.Closed:
185185
InvokeEvent(Closed, new NetMQMonitorSocketEventArgs(this, monitorEvent.Addr, GetArg<AsyncSocket>(), SocketEvents.Closed));
186186
break;
187187
case SocketEvents.CloseFailed:
188-
InvokeEvent(CloseFailed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, GetArg<ErrorCode>(), SocketEvents.CloseFailed));
188+
InvokeEvent(CloseFailed, new NetMQMonitorErrorEventArgs(this, monitorEvent.Addr, (ErrorCode)GetArg<int>(), SocketEvents.CloseFailed));
189189
break;
190190
case SocketEvents.Disconnected:
191191
InvokeEvent(Disconnected, new NetMQMonitorSocketEventArgs(this, monitorEvent.Addr, GetArg<AsyncSocket>(), SocketEvents.Disconnected));

src/NetMQ/NetMQPoller.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,6 @@ public void Run(SynchronizationContext syncContext)
508508
/// </summary>
509509
private void RunPoller()
510510
{
511-
Assumes.NotNull(m_pollSet);
512-
Assumes.NotNull(m_pollact);
513-
514511
try
515512
{
516513
// Recalculate all timers now
@@ -558,6 +555,8 @@ private void RunPoller()
558555

559556
var isItemAvailable = false;
560557

558+
Assumes.NotNull(m_pollSet);
559+
561560
if (m_pollSet.Length != 0)
562561
{
563562
isItemAvailable = m_netMqSelector.Select(m_pollSet, m_pollSet.Length, timeout);
@@ -596,6 +595,8 @@ private void RunPoller()
596595

597596
if (item.Socket != null)
598597
{
598+
Assumes.NotNull(m_pollact);
599+
599600
NetMQSocket socket = m_pollact[i];
600601

601602
if (item.ResultEvent.HasError())

0 commit comments

Comments
 (0)