1
0
mirror of https://github.com/XFox111/SimpleOTP.git synced 2026-04-22 08:00:45 +03:00

Initial commit

This commit is contained in:
2021-05-28 18:36:54 +03:00
parent 890c34dd5b
commit 3a629ed8c5
29 changed files with 2047 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
// ------------------------------------------------------------
// Copyright ©2021 Eugene Fox. All rights reserved.
// Code by Eugene Fox (aka XFox)
//
// Licensed under MIT license (https://opensource.org/licenses/MIT)
// ------------------------------------------------------------
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SimpleOTP.Models;
namespace SimpleOTP.Test.Models
{
/// <summary>
/// Unit-tests for OTP code model.
/// </summary>
[TestClass]
public class OTPCodeUnitTest
{
/// <summary>
/// Get formatted OTP code.
/// </summary>
[TestMethod("Code formatting")]
public void Test_GetFullCode()
{
OTPCode code = new ()
{
Code = 123,
Expiring = DateTime.UtcNow.AddSeconds(30),
};
Assert.AreEqual("000123", code.GetCode());
Assert.AreEqual("000 123", code.GetCode("000 000"));
}
}
}