Files
mRemoteNG/mRemoteNGTests/Credential/CredentialDeletionMsgBoxConfirmerTests.cs
2017-08-06 10:40:36 -05:00

43 lines
1.3 KiB
C#

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(new[] { _credentialRecord }), Is.True);
}
[Test]
public void ClickingNoReturnsFalse()
{
var deletionConfirmer = new CredentialDeletionMsgBoxConfirmer(MockClickNo);
Assert.That(deletionConfirmer.Confirm(new [] { _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;
}
}
}