// ------------------------------------------------------------ // 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 System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; using SimpleOTP.Models; namespace SimpleOTP.Test { /// /// OTP factory class unit-tests. /// [TestClass] public class OTPFactoryUnitTest { /// /// Complex test of OTP factory. /// /// . [TestMethod("Overall factory test")] public async Task TestFactory() { OTPConfiguration config = OTPConfiguration.GetConfiguration("ESQVTYRM2CWZC3NX24GRRWIAUUWVHWQH", "FoxDev Studio", "eugene@xfox111.net"); config.Period = TimeSpan.FromSeconds(3); using OTPFactory factory = new (config, 1500); System.Diagnostics.Debug.WriteLine(factory.Configuration); var code = factory.CurrentCode; factory.Configuration = config; factory.CurrentCode = code; await Task.Delay(3500); Assert.AreNotEqual(code.Code, factory.CurrentCode.Code); } } }