diff options
Diffstat (limited to 'TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs')
-rw-r--r-- | TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs b/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs new file mode 100644 index 0000000..1138f54 --- /dev/null +++ b/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; + +namespace TwoStepsAuthenticator.UnitTests { + + [TestFixture] + public class UsedCodesManagerTests { + + [Test] + public void Can_add_codes() { + var manager = new UsedCodesManager(); + + Assert.IsFalse(manager.IsCodeUsed(42uL, "def")); + manager.AddCode(42uL, "def"); + Assert.IsTrue(manager.IsCodeUsed(42uL, "def")); + } + + } + + internal class MockUsedCodesManager : IUsedCodesManager { + public ulong? LastChallenge { get; private set; } + public string LastCode { get; private set; } + + public void AddCode(ulong challenge, string code) { + this.LastChallenge = challenge; + this.LastCode = code; + } + + public bool IsCodeUsed(ulong challenge, string code) { + return false; + } + } +} |