public void TestAddBcd() { var tags = new EmvTags(); tags.AddBcd(Tag.term_county_code, "710"); byte[] actual = tags[Tag.term_county_code]; byte[] expected = "0710".ToByteArray(); CollectionAssert.AreEqual(expected, actual); }
public void TestTrack2Masked() { var tags = new EmvTags { { Tag.track2_eq_data, "4658545742527290d130520132101f".ToByteArray() } }; var actual = tags.ToString(); var expected = "0x57 'track2_eq_data ' = [******************************]"; Assert.AreEqual(expected, actual); }
public void TestApplPanMasked() { var tags = new EmvTags { { Tag.appl_pan, "1234567890123456".ToByteArray() } }; var actual = tags.ToString(); var expected = "0x5a 'appl_pan ' = [****************]"; Assert.AreEqual(expected, actual); }
public void TestSingleItemToString() { var tags = new EmvTags(); tags.AddBcd(Tag.tran_date, "100824"); var expected = "0x9a 'tran_date ' = [100824]"; var actual = tags.ToString(); Assert.AreEqual(expected, actual); }
public void TestGetString() { var expected = "TestApp"; var tags = new EmvTags(); tags[Tag.appl_label] = Encoding.ASCII.GetBytes(expected); var actual = tags.GetString(Tag.appl_label); Assert.AreEqual(expected, actual); }
public void TestGetBcd() { var tags = new EmvTags(); tags.AddBcd(Tag.term_county_code, "710"); string actual = tags.GetBcd(Tag.term_county_code); string expected = "0710"; Assert.AreEqual(expected, actual); }
public void TestAddString() { var str = "TestApp"; var tags = new EmvTags(); tags.AddString(Tag.appl_label, str); var expected = Encoding.ASCII.GetBytes(str); var actual = tags[Tag.appl_label]; CollectionAssert.AreEqual(expected, actual); }
public void TestPack() { var tags = new EmvTags { { Tag.appl_id, "a0000000031010".ToByteArray() }, { Tag.tran_date, "100824".ToByteArray() } }; byte[] expected = "9f0607a00000000310109a03100824".ToByteArray(); byte[] actual = tags.Pack(); CollectionAssert.AreEqual(expected, actual); }
public void TestTwoItemsToString() { var tags = new EmvTags(); tags.AddBcd(Tag.tran_date, "100824"); tags.AddBcd(Tag.term_county_code, "710"); var expected = "0x9a 'tran_date ' = [100824]" + Environment.NewLine + "0x9f1a 'term_county_code ' = [0710]"; var actual = tags.ToString(); Assert.AreEqual(expected, actual); }
public void TestPack() { var content = "9f02060000000010009f03060000000000004f07a0000000041010820258009f360200019f2608e4539ffffaa341db9f2701808e100000000000000000420341031e031f009f34034203009f10120212a0000f240000dac000000000000000ff9f3303e0f0c89f1a0202889f350122950500000480009f420208409a031106239f4104000000019c01009f37048202d9dc"; var tags = new EmvTags { { Tag.icc_request, content.ToByteArray() } }; var packed = tags.Pack(); var actual = packed.ToHex().Substring(0, 12); var expected = "FF2081919F02"; Assert.AreEqual(expected, actual); }