mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
created a test for the credential deletion confirmer
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Credential;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.Credential
|
||||
{
|
||||
public class CredentialDeletionMsgBoxConfirmerTests
|
||||
{
|
||||
private ICredentialRecord _credentialRecord;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_credentialRecord = Substitute.For<ICredentialRecord>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingYesReturnsTrue()
|
||||
{
|
||||
var deletionConfirmer = new CredentialDeletionMsgBoxConfirmer(MockClickYes);
|
||||
Assert.That(deletionConfirmer.Confirm(_credentialRecord), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingNoReturnsFalse()
|
||||
{
|
||||
var deletionConfirmer = new CredentialDeletionMsgBoxConfirmer(MockClickNo);
|
||||
Assert.That(deletionConfirmer.Confirm(_credentialRecord), Is.False);
|
||||
}
|
||||
|
||||
private DialogResult MockClickYes(string promptMessage, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
return DialogResult.Yes;
|
||||
}
|
||||
|
||||
private DialogResult MockClickNo(string promptMessage, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
return DialogResult.No;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,7 @@
|
||||
<Compile Include="Connection\AbstractConnectionInfoDataTests.cs" />
|
||||
<Compile Include="Connection\ConnectionInfoComparerTests.cs" />
|
||||
<Compile Include="Connection\Protocol\ProtocolListTests.cs" />
|
||||
<Compile Include="Credential\CredentialDeletionMsgBoxConfirmerTests.cs" />
|
||||
<Compile Include="Credential\CredentialDomainUserComparerTests.cs" />
|
||||
<Compile Include="Credential\CredentialProviderCatalogTests.cs" />
|
||||
<Compile Include="Credential\CredentialRecordCatalogTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user