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); } }
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)); } }
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); } }
public void TestDisksEmpty() { using (var persistence = GetPersistenceWithUser()) { var s = new DiskServiceImpl(persistence); Assert.AreEqual(0, s.Disks(_userDto).Count); } }
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); } }