public void Clean()
 {
     if (TestUser != null)
     {
         foreach (var file in _filesRepository.GetUserFiles(TestUser.Id))
         {
             _sharesRepository.Delete(Share);
             _filesRepository.Delete(file.Id);
         }
         _usersRepository.Delete(TestUser.Id);
     }
 }
Ejemplo n.º 2
0
 public void DeleteShare(Guid id)
 {
     try
     {
         _sharesRepository.Delete(id);
         Log.Logger.ServiceLog.Info("Delete share with id: {0}", id);
     }
     catch (Exception ex)
     {
         Log.Logger.ServiceLog.Error(ex.Message);
         throw;
     }
 }
Ejemplo n.º 3
0
        public void ShouldAddAndGetShares()
        {
            //arrange
            List <Share> shares = new List <Share>();
            var          share  = new Share
            {
                FileId = TestFile.Id,
                UserId = TestUser.Id
            };

            shares.Add(share);
            //act
            var newShare = _sharesRepository.Add(share);
            var result   = _sharesRepository.GetFileUsers(TestFile.Id);

            //asserts
            foreach (var res in result)
            {
                Assert.AreEqual(res.Id, share.UserId);
            }
            _sharesRepository.Delete(newShare.id);
        }