reorganized some test files and added tests for null args

This commit is contained in:
David Sparer
2017-01-13 12:12:22 -07:00
parent 2ce31f35cc
commit 05d8b7983a
8 changed files with 49 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Controls;
using NSubstitute;
using NUnit.Framework;
@@ -35,5 +35,12 @@ namespace mRemoteNGTests.Tree
_clickHandler.Execute(new ConnectionInfo());
_connectionTree.DidNotReceiveWithAnyArgs().ToggleExpansion(new ConnectionInfo());
}
[Test]
public void ExceptionThrownOnConstructorNullArg()
{
// ReSharper disable once ObjectCreationAsStatement
Assert.Throws<ArgumentNullException>(() => new ExpandNodeClickHandler(null));
}
}
}

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
using mRemoteNG.Tree;
using NSubstitute;
using NUnit.Framework;
@@ -25,5 +26,12 @@ namespace mRemoteNGTests.Tree
_clickHandler.Execute(connectionInfo);
_connectionInitiator.Received().OpenConnection(connectionInfo);
}
[Test]
public void ExceptionThrownWhenConstructorGivenNullArg()
{
// ReSharper disable once ObjectCreationAsStatement
Assert.Throws<ArgumentNullException>(() => new OpenConnectionClickHandler(null));
}
}
}

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
using mRemoteNG.Tree;
using NSubstitute;
using NUnit.Framework;
@@ -25,5 +26,12 @@ namespace mRemoteNGTests.Tree
_clickHandler.Execute(connectionInfo);
_connectionInitiator.Received().SwitchToOpenConnection(connectionInfo);
}
[Test]
public void ExceptionThrownWhenConstructorGivenNullArg()
{
// ReSharper disable once ObjectCreationAsStatement
Assert.Throws<ArgumentNullException>(() => new SwitchToConnectionClickHandler(null));
}
}
}

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
using mRemoteNG.Tree;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Controls;
@@ -30,6 +31,13 @@ namespace mRemoteNGTests.Tree
_connectionInitiator.ReceivedWithAnyArgs(2).OpenConnection(new ConnectionInfo());
}
[Test]
public void ExceptionThrownWhenConstructorGivenNullArg()
{
// ReSharper disable once ObjectCreationAsStatement
Assert.Throws<ArgumentNullException>(() => new PreviousSessionOpener(null));
}
private RootNodeInfo BuildTree()
{
var root = new RootNodeInfo(RootNodeType.Connection);

View File

@@ -150,12 +150,12 @@
<Compile Include="Security\EncryptedSecureStringTests.cs" />
<Compile Include="Security\LegacyRijndaelCryptographyProviderTests.cs" />
<Compile Include="Tree\ConnectionTreeTests.cs" />
<Compile Include="Tree\ExpandNodeClickHandlerTests.cs" />
<Compile Include="Tree\ClickHandlers\ExpandNodeClickHandlerTests.cs" />
<Compile Include="Tree\NodeSearcherTests.cs" />
<Compile Include="Tree\OpenConnectionClickHandlerTests.cs" />
<Compile Include="Tree\ClickHandlers\OpenConnectionClickHandlerTests.cs" />
<Compile Include="Tree\PreviousSessionOpenerTests.cs" />
<Compile Include="Tree\RootNodeInfoTests.cs" />
<Compile Include="Tree\SwitchToConnectionClickHandlerTests.cs" />
<Compile Include="Tree\ClickHandlers\SwitchToConnectionClickHandlerTests.cs" />
<Compile Include="UI\Controls\TestForm.cs">
<SubType>Form</SubType>
</Compile>

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=tree_005Cclickhandlers/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
namespace mRemoteNG.Tree
@@ -9,6 +10,8 @@ namespace mRemoteNG.Tree
public OpenConnectionClickHandler(IConnectionInitiator connectionInitiator)
{
if (connectionInitiator == null)
throw new ArgumentNullException(nameof(connectionInitiator));
_connectionInitiator = connectionInitiator;
}

View File

@@ -1,4 +1,5 @@
using mRemoteNG.Connection;
using System;
using mRemoteNG.Connection;
namespace mRemoteNG.Tree
@@ -9,6 +10,8 @@ namespace mRemoteNG.Tree
public SwitchToConnectionClickHandler(IConnectionInitiator connectionInitiator)
{
if (connectionInitiator == null)
throw new ArgumentNullException(nameof(connectionInitiator));
_connectionInitiator = connectionInitiator;
}