public void Init()
        {
            TestUser = _usersRepository.Add("Alex", "Ivanov", "*****@*****.**");

            var file = new File
            {
                Name  = "testFile",
                Owner = TestUser
            };

            TestFile = _filesRepository.Add(file);
            Share    = new Share()
            {
                File = TestFile,
                User = TestUser
            };
            _sharesRepository.Add(Share);
        }
Пример #2
0
 public Share CreateShare([FromBody] Share share)
 {
     try
     {
         return(_sharesRepository.Add(share));
     }
     catch (Exception ex)
     {
         Log.Logger.ServiceLog.Error(ex.Message);
         throw;
     }
 }
Пример #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);
        }
Пример #4
0
 public void CreateShare(Share share)
 {
     Logger.ServiceLog.Info("Create share with user id: {0} and file id: {1}", share.User.Id, share.File.Id);
     _sharesRepository.Add(share);
 }