Example #1
0
        public void SearchMaskShouldReturnTheRelatedMask()
        {
            PANs newRecord = new PANs();

            newRecord.PAN       = PAN;
            newRecord.MaskedPAN = mask;
            _db.PANs.Add(newRecord);
            _db.SaveChanges();
            _sut.SearchMask(PAN).Should().Be(mask);
        }
Example #2
0
        public string SearchMask(string PAN)
        {
            PANs PANdata = _db.PANs.SingleOrDefault(x => x.PAN == PAN);

            if (PANdata != null)
            {
                return(PANdata.MaskedPAN.Trim());
            }

            return(null);
        }
Example #3
0
        public string SearchPAN(string mask)
        {
            PANs PANdata = _db.PANs.SingleOrDefault(x => x.MaskedPAN == mask);

            if (PANdata != null)
            {
                return(PANdata.PAN.Trim());
            }

            return(null);
        }
Example #4
0
        public void AddPanAndMask(string PAN, string mask)
        {
            PANs NewRecord = new PANs();

            if ((SearchMask(PAN) == null) || (SearchPAN(mask) == null))
            {
                NewRecord.PAN       = PAN;
                NewRecord.MaskedPAN = mask;
                _db.PANs.Add(NewRecord);
                _db.SaveChanges();
            }
        }