public void CheckSessionID_Test_1() { // Arrange string obj = ""; Dictionary <string, Payment> payments = new Dictionary <string, Payment>(); Payment next; string guid = ""; // Act for (int i = 0; i < 10; i++) { next = new Payment(i, obj, Guid.NewGuid().ToString()); payments.Add(next.sessionID, next); if (i == 5) { guid = next.sessionID; } } DateTime time = new DateTime(); bool cheack = LuhnController.CheckSessionID(payments, guid, ref time); // Assert Assert.AreEqual(true, cheack); }
public GenerateNumber() { using var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); var logger = loggerFactory.CreateLogger <LuhnController>(); _luhnController = new LuhnController(logger); _formatTypes = GetFormatTypes_All(); }
public void CheckLuhn_Test_2() { // Arrange string num = "1461261212345458"; // Act bool check = LuhnController.CheckLuhn(num); // Assert Assert.AreEqual(false, check); }
public void CheckLuhn_Test_1() { // Arrange string num = "4461261212345468"; // Act bool check = LuhnController.CheckLuhn(num); // Assert Assert.AreEqual(true, check); }
public void CheckDate_Test_3() { // Arrange DateTime date = DateTime.Now; DateTime date2 = new DateTime(2021, 07, 19, 2, 59, 30); // Act bool check = LuhnController.CheckDate(date, date2); // Assert Assert.AreEqual(false, check); }
public void CheckDate_Test_1() { // Arrange DateTime date = new DateTime(2020, 07, 19, 3, 09, 30); DateTime date2 = new DateTime(2020, 07, 19, 3, 05, 30); // Act bool check = LuhnController.CheckDate(date, date2); // Assert Assert.AreEqual(true, check); }
public void CheckSessionID_Test_2() { // Arrange string obj = ""; Dictionary <string, Payment> payments = new Dictionary <string, Payment>(); Payment next; // Act for (int i = 0; i < 10; i++) { next = new Payment(i, obj, Guid.NewGuid().ToString()); payments.Add(next.sessionID, next); } DateTime time = new DateTime(); bool cheack2 = LuhnController.CheckSessionID(payments, "kjlkfdjglks-dfh-fdsg", ref time); // Assert Assert.AreEqual(false, cheack2); }
public void DeserializationDict_and_GetResult_Tests_2() { // Arrange string obj = ""; Dictionary <string, Payment> payments = new Dictionary <string, Payment>(); Dictionary <string, Payment> payments2 = new Dictionary <string, Payment>(); Payment next; for (int i = 0; i < 10; i++) { next = new Payment(i, obj, Guid.NewGuid().ToString()); payments.Add(next.sessionID, next); payments2.Add(next.sessionID, next); } // Act BinaryFormatter bf = new BinaryFormatter(); using (FileStream stream = new FileStream("test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite)) { bf.Serialize(stream, payments); payments.Clear(); } using (FileStream stream = new FileStream("test.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite)) { stream.Position = 0; payments = LuhnController.DeserializationDict(bf, stream); } // Assert string one = AdminController.GetResult(payments); string two = AdminController.GetResult(payments2); Assert.AreEqual(one, two); }