예제 #1
0
 public void Persists()
 {
     TestPersistentId(FileSystem, idFilePath =>
     {
         var id = PersistentId.Load(FileSystem, idFilePath);
         PersistentId.Load(FileSystem, idFilePath).Should().Be(id);
     });
 }
예제 #2
0
 public void CreatesDirectoryIfMissing()
 {
     using (var testDirectory = new DisposableDirectory(FileSystem))
     {
         var missingDirectory = testDirectory.Path / "MissingDirectory";
         var id = PersistentId.Load(FileSystem, missingDirectory / "Cache.id");
         id.Should().NotBe(Guid.Empty);
         FileSystem.DirectoryExists(missingDirectory).Should().BeTrue();
     }
 }
예제 #3
0
 public void CreatesNonSpecialValue()
 {
     TestPersistentId(FileSystem, idFilePath =>
     {
         var id = PersistentId.Load(FileSystem, idFilePath);
         id.Should().NotBe(CacheDeterminism.None.EffectiveGuid);
         id.Should().NotBe(CacheDeterminism.Tool.EffectiveGuid);
         id.Should().NotBe(CacheDeterminism.SinglePhaseNonDeterministic.EffectiveGuid);
     });
 }
예제 #4
0
 public void CreatesNewOnCorrupted()
 {
     TestPersistentId(FileSystem, idFilePath =>
     {
         var id = PersistentId.Load(FileSystem, idFilePath);
         FileSystem.WriteAllBytes(idFilePath, new byte[] {});
         var newId = PersistentId.Load(FileSystem, idFilePath);
         newId.Should().NotBe(id);
     });
 }
예제 #5
0
 public void CreatesNewOnNonexistent()
 {
     TestPersistentId(FileSystem, idFilePath =>
     {
         var id = PersistentId.Load(FileSystem, idFilePath);
         id.Should().NotBe(Guid.Empty);
         FileSystem.DeleteFile(idFilePath);
         var newId = PersistentId.Load(FileSystem, idFilePath);
         newId.Should().NotBe(Guid.Empty);
         newId.Should().NotBe(id);
     });
 }