Пример #1
0
 public DependencySnapshotInstallerTests()
 {
     _targetPathInstalled  = DependencySnapshotFolderNameTools.CreateUniqueName();
     _targetPathInstalling = DependencySnapshotFolderNameTools.ConvertInstalledToInstalling(_targetPathInstalled);
     _mockStorage.Setup(_ => _.CreateInstallingSnapshot(_targetPathInstalled)).Returns(_targetPathInstalling);
     _mockStorage.Setup(_ => _.PromoteInstallingSnapshotToInstalledAtomically(_targetPathInstalled));
 }
Пример #2
0
        public void NamesConvertedFromInstalledToInstallingDoNotHaveInstalledPostfix()
        {
            var name = DependencySnapshotFolderNameTools.CreateUniqueName();
            var convertedToInstalling = DependencySnapshotFolderNameTools.ConvertInstalledToInstalling(name);

            Assert.False(convertedToInstalling.EndsWith(DependencySnapshotFolderNameTools.InstalledPostfix));
        }
Пример #3
0
        public void UniqueNamesConvertedFromInstalledToInstallingAreStillUnique()
        {
            var name1 = DependencySnapshotFolderNameTools.CreateUniqueName();

            Thread.Sleep(2); // A snapshot name created 2 milliseconds later must be different
            var name2 = DependencySnapshotFolderNameTools.CreateUniqueName();

            var convertedToInstalling1 = DependencySnapshotFolderNameTools.ConvertInstalledToInstalling(name1);
            var convertedToInstalling2 = DependencySnapshotFolderNameTools.ConvertInstalledToInstalling(name2);

            Assert.NotEqual(convertedToInstalling1, convertedToInstalling2);
        }
        public void UniqueNamesConvertedFromInstalledToInstallingAreStillUnique()
        {
            // A snapshot name created 1 microsecond (10 ticks) later must be different
            var waitTime = new TimeSpan(10);

            var name1 = DependencySnapshotFolderNameTools.CreateUniqueName();

            Thread.Sleep(waitTime);
            var name2 = DependencySnapshotFolderNameTools.CreateUniqueName();

            var convertedToInstalling1 = DependencySnapshotFolderNameTools.ConvertInstalledToInstalling(name1);
            var convertedToInstalling2 = DependencySnapshotFolderNameTools.ConvertInstalledToInstalling(name2);

            Assert.NotEqual(convertedToInstalling1, convertedToInstalling2);
        }