예제 #1
0
        public async Task Get_ValidGuid()
        {
            _dbContext.GuidList.Add(new GuidDataModel
            {
                Guid   = new Guid("6F729C08-A503-4C16-9262-46AAEF1F2CA1"),
                Expire = 185823,
                User   = "******"
            });
            _dbContext.SaveChanges();

            Guid newGuid = new Guid("6F729C08-A503-4C16-9262-46AAEF1F2CA1");

            var result = await _guidController.GetGuid(newGuid);

            Assert.IsType <GuidAPIModel>(result.Value);
            Assert.Equal(newGuid, (result.Value).Guid);
            Assert.Equal("test user 1", (result.Value).User);
            Assert.Equal(185823, (result.Value).Expire);
        }
예제 #2
0
        public void Delete(Guid guid)
        {
            GuidDataModel existingGuid = _context.GuidList.Find(guid);

            if (existingGuid == null)
            {
                throw new RecordNotFound(Constants.GUID_NOT_FOUND);
            }
            else
            {
                _context.GuidList.Remove(existingGuid);
                _context.SaveChanges();

                _cache.Delete(guid);
            }
        }