コード例 #1
0
        public void TestUpdateDisk()
        {
            using (var persistence = GetPersistence())
            {
                var user = persistence.CreateUser(_userDto.Login, _userDto.HashedPassword);

                var disk = persistence.CreateDisk(user, new DiskOptionsDto());
                disk.LocalVersion = 10;
                disk.LastServerVersion = 10;
                persistence.UpdateDisk(disk);

                var s = new DiskServiceImpl(persistence);

                disk.NewestBlock = 77;
                s.UpdateDisk(user, disk);
                Assert.AreEqual(77, s.Disks(user).First().NewestBlock);
            }
        }
コード例 #2
0
        public void TestSynchronizationStateUpToDate()
        {
            using (var persistence = GetPersistence())
            {
                var user = persistence.CreateUser(_userDto.Login, _userDto.HashedPassword);
                persistence.CreateDisk(user, new DiskOptionsDto());

                var s = new DiskServiceImpl(persistence);

                var clonedDisk = s.Disks(user).First();
                Assert.AreEqual(SynchronizationState.UpToDate, s.FetchSynchronizationState(user, clonedDisk));
            }
        }
コード例 #3
0
 public void TestDisks()
 {
     using (var persistence = GetPersistenceWithUser())
     {
         var disk = new DiskDto { UserId = _userDto.Id, Id = 1 };
         persistence.CreateDisk(_userDto, new DiskOptionsDto());
         var s = new DiskServiceImpl(persistence);
         Assert.AreEqual(1, s.Disks(_userDto).Count);
         Assert.AreEqual(disk.Id, s.Disks(_userDto).First().Id);
     }
 }
コード例 #4
0
 public void TestDisksEmpty()
 {
     using (var persistence = GetPersistenceWithUser())
     {
         var s = new DiskServiceImpl(persistence);
         Assert.AreEqual(0, s.Disks(_userDto).Count);
     }
 }
コード例 #5
0
 public void TestDeleteDisks()
 {
     using (var persistence = GetPersistence())
     {
         var user = persistence.CreateUser(_userDto.Login, _userDto.HashedPassword);
         var disk = persistence.CreateDisk(user, new DiskOptionsDto());
         var s = new DiskServiceImpl(persistence);
         Assert.IsTrue(s.DeleteDisk(user, disk));
         Assert.AreEqual(0, s.Disks(user).Count);
     }
 }