Beispiel #1
0
        public void FileBlobTests_LeaseTimeIsUpdatedWhenLeasingAlreadyLeasedFile()
        {
            var      testFile = new FileInfo(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
            FileBlob blob     = new FileBlob(testFile.FullName);
            var      data     = Encoding.UTF8.GetBytes("Hello, World!");

            blob.Write(data);

            var leasePeriodMilliseconds = 10000;

            blob.Lease(leasePeriodMilliseconds);

            var leaseTime = PersistentStorageHelper.GetDateTimeFromLeaseName(blob.FullPath);

            Assert.NotNull(blob.Lease(10000));

            var newLeaseTime = PersistentStorageHelper.GetDateTimeFromLeaseName(blob.FullPath);

            Assert.NotEqual(leaseTime, newLeaseTime);

            blob.Delete();
        }