Exemple #1
0
        public void Encode_Decode_Results_Consistent()
        {
            int before = 8645;
            int after  = IdEncoder.Decode(IdEncoder.Encode(before));

            Assert.AreEqual(before, after);


            before = int.MaxValue;
            after  = IdEncoder.Decode(IdEncoder.Encode(before));

            Assert.AreEqual(before, after);
        }
Exemple #2
0
        public string CreateUrlIdentifier(string url)
        {
            var urlEntity = (from u in repository.Urls
                             where u.Value == url
                             select u
                             ).FirstOrDefault();

            if (urlEntity == null)
            {
                urlEntity = new Url()
                {
                    Value = url
                };
                repository.InsertUrl(urlEntity);
            }

            return(IdEncoder.Encode(urlEntity.Id));
        }