mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
added some unit tests
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using mRemoteNG.Config.Connections.Multiuser;
|
||||
using mRemoteNG.Config.DatabaseConnectors;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
// ReSharper disable ObjectCreationAsStatement
|
||||
|
||||
namespace mRemoteNGTests.Config.Connections.Multiuser
|
||||
{
|
||||
public class ConnectionsUpdateAvailableEventArgsTests
|
||||
{
|
||||
private IDatabaseConnector _databaseConnector;
|
||||
private DateTime _dateTime;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_databaseConnector = Substitute.For<IDatabaseConnector>();
|
||||
_dateTime = DateTime.MinValue;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CantProvideNullDatabaseConnectorToCtor()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => new ConnectionsUpdateAvailableEventArgs(null, _dateTime));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DatabaseConnectorPropertySet()
|
||||
{
|
||||
var eventArgs = new ConnectionsUpdateAvailableEventArgs(_databaseConnector, _dateTime);
|
||||
Assert.That(eventArgs.DatabaseConnector, Is.EqualTo(_databaseConnector));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateTimePropertySet()
|
||||
{
|
||||
var eventArgs = new ConnectionsUpdateAvailableEventArgs(_databaseConnector, _dateTime);
|
||||
Assert.That(eventArgs.UpdateTime, Is.EqualTo(_dateTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="App\UpdaterTests.cs" />
|
||||
<Compile Include="BinaryFileTests.cs" />
|
||||
<Compile Include="Config\Connections\Multiuser\ConnectionsUpdateAvailableEventArgsTests.cs" />
|
||||
<Compile Include="Config\Serializers\DataTableDeserializerTests.cs" />
|
||||
<Compile Include="Config\CredentialHarvesterTests.cs" />
|
||||
<Compile Include="Config\CredentialRecordLoaderTests.cs" />
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace mRemoteNG.Config.Connections.Multiuser
|
||||
|
||||
public ConnectionsUpdateAvailableEventArgs(IDatabaseConnector databaseConnector, DateTime updateTime)
|
||||
{
|
||||
if (databaseConnector == null)
|
||||
throw new ArgumentNullException(nameof(databaseConnector));
|
||||
DatabaseConnector = databaseConnector;
|
||||
UpdateTime = updateTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user