Files
Libation/Source/_Tests/LibationFileManager.Tests/DiskSpaceHelperTests.cs
rmcrackan b9490966bb * Multi-step backup: PDF and later steps now run in the same awaited chain, so disk full on PDF stops the queue instead of counting as success.
* Detection: Quota / NAS “out of space” messages are treated like disk full, not generic retries.
2026-05-18 10:00:32 -04:00

35 lines
1.2 KiB
C#

using LibationFileManager;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
namespace LibationFileManager.Tests;
[TestClass]
public class DiskSpaceHelperTests
{
[TestMethod]
public void IsDiskFullException_detects_message()
{
var ex = new IOException("There is not enough space on the disk. : 'C:\\temp\\x.aaxc'.");
Assert.IsTrue(DiskSpaceHelper.IsDiskFullException(ex));
}
[TestMethod]
public void IsDiskFullException_detects_message_in_aggregate()
{
var inner = new IOException("Failed to create file because the disk was full.");
var ex = new AggregateException(inner);
Assert.IsTrue(DiskSpaceHelper.IsDiskFullException(ex));
}
[TestMethod]
public void ErrorMessageIndicatesDiskFull_matches_common_phrases()
{
Assert.IsTrue(DiskSpaceHelper.ErrorMessageIndicatesDiskFull("There is not enough space on the disk. : 'C:\\temp\\x.aaxc'."));
Assert.IsTrue(DiskSpaceHelper.ErrorMessageIndicatesDiskFull("Write failed: disk quota has been exceeded."));
Assert.IsTrue(DiskSpaceHelper.ErrorMessageIndicatesDiskFull("No space left on device"));
Assert.IsFalse(DiskSpaceHelper.ErrorMessageIndicatesDiskFull("Unable to read beyond the end of the stream."));
}
}