/// <summary> /// Parses the <param name="value">argument</param> and returns an object /// that implements the <see cref="ITrack2"/> interface. /// </summary> public static ITrack2 Parse(byte[] value) { var s = value.NetMf().Format("X"); var i = s.Split('D'); var result = new Track2DataFromIcc { CardNumber = i[0].TrimEnd(new [] { 'F', 'f' }), ExpiryDateYear = i[1].Substring(0, 2).NetMf().ToLiteralByte, ExpiryDateMonth = i[1].Substring(2, 2).NetMf().ToLiteralByte, ServiceCode = int.Parse(i[1].Substring(4, 3)), }; try { var e = i[1]; result.DiscretionaryData = (e.Length > 7) ? e.Substring(7, e.Length - 7).TrimEnd(new [] { '?' }) : string.Empty; } catch (Exception) { result.DiscretionaryData = string.Empty; } return(result); }
/// <summary> /// Act on the object or method under test. /// </summary> protected override void Act() { sut = Track2DataFromIcc.Parse(ms.ToArray()); }