added null test for the composite click handler

This commit is contained in:
David Sparer
2017-01-14 10:36:54 -07:00
parent 9b42dc9f10
commit d03f830622
2 changed files with 12 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
using mRemoteNG.Tree;
using NSubstitute;
using NUnit.Framework;
@@ -28,5 +29,11 @@ namespace mRemoteNGTests.Tree
handler1.Received().Execute(_connectionInfo);
handler2.Received().Execute(_connectionInfo);
}
[Test]
public void ThrowWhenExecuteGivenNullArg()
{
Assert.Throws<ArgumentNullException>(() => _clickHandler.Execute(null));
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using mRemoteNG.Connection;
@@ -10,7 +11,8 @@ namespace mRemoteNG.Tree
public void Execute(ConnectionInfo clickedNode)
{
if (clickedNode == null) return;
if (clickedNode == null)
throw new ArgumentNullException(nameof(clickedNode));
foreach (var handler in ClickHandlers)
{
handler.Execute(clickedNode);