Write if differ file write tests.
MODIFY
WalletWasabi.Tests/StoreTests.cs
WalletWasabi.Tests/StoreTests.cs
@@ -49,11 +49,17 @@ namespace WalletWasabi.Tests
ioman1.DeleteMe();
Assert.False(ioman1.Exists());
+ Assert.False(File.Exists(ioman1.DigestFilePath));
+
// Write the data to the file.
await ioman1.WriteAllLinesAsync(lines);
Assert.True(ioman1.Exists());
+ // Check if the digest file is created.
+
+ Assert.True(File.Exists(ioman1.DigestFilePath));
+
// Read back the content and check.
var readLines = await ioman1.ReadAllLinesAsync();
@@ -67,6 +73,22 @@ namespace WalletWasabi.Tests
Assert.Equal(readline, line);
}
+
+ // Check digest file, and write only differ logic.
+
+ using (File.OpenWrite(ioman1.OriginalFilePath))
+ {
+ // Should be OK because the same data is written.
+ await ioman1.WriteAllLinesAsync(lines);
+ }
+
+ lines.Add("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
+
+ using (File.OpenWrite(ioman1.OriginalFilePath))
+ {
+ // Should fail because different data is written.
+ await Assert.ThrowsAsync<IOException>(async () => await ioman1.WriteAllLinesAsync(lines));
+ }
}
}
}

Write if differ file write tests.