1
0
mirror of https://github.com/XFox111/SimpleOTP.git synced 2026-04-22 08:00:45 +03:00
Files
SimpleOTP/SimpleOTP.Test/Models/OTPCodeUnitTest.cs
T
2021-05-28 18:36:54 +03:00

37 lines
872 B
C#

// ------------------------------------------------------------
// 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"));
}
}
}