Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e54506e
Refactor ResourceManagerTraceDataHandler implementation
JensVandewalle Aug 12, 2026
abafb7f
Apply suggestions from code review
JensVandewalle Aug 12, 2026
70511c2
Add file property support to MediaOps Plan API
JensVandewalle Aug 12, 2026
ea3e98b
Merge branch '45799_reservation-backend' into 43980_Implement-file-ty…
JensVandewalle Aug 12, 2026
4e1be16
Stricter file name validation and improved attachment cleanup
JensVandewalle Aug 12, 2026
b32d166
Build DOM resource ID map from error lists for quarantine
JensVandewalle Aug 12, 2026
b282495
Improve file attachment handling in property settings
JensVandewalle Aug 12, 2026
3054119
Improve file name validation and add unit tests
JensVandewalle Aug 12, 2026
94b2fcd
Initial plan
Copilot Aug 12, 2026
357fbd7
Fix orphaned attachments by reconciling against GetNames instead of t…
Copilot Aug 12, 2026
e25cc79
Merge pull request #269 from SkylineCommunications/copilot/fix-code-r…
Copilot Aug 13, 2026
3acaec0
Revert merge of PR #269 (fix-code-review-suggestion)
Copilot Aug 13, 2026
8c82e37
Refactor ResourceManagerTraceDataHandler implementation
JensVandewalle Aug 12, 2026
c2b15e5
Apply suggestions from code review
JensVandewalle Aug 12, 2026
3088891
Build DOM resource ID map from error lists for quarantine
JensVandewalle Aug 12, 2026
c3baf2f
Add file property support to MediaOps Plan API
JensVandewalle Aug 12, 2026
3daabea
Stricter file name validation and improved attachment cleanup
JensVandewalle Aug 12, 2026
06814e3
Improve file attachment handling in property settings
JensVandewalle Aug 12, 2026
a30310c
Improve file name validation and add unit tests
JensVandewalle Aug 12, 2026
1fcecfd
Initial plan
Copilot Aug 12, 2026
db75799
Fix orphaned attachments by reconciling against GetNames instead of t…
Copilot Aug 12, 2026
4bab731
Revert merge of PR #269 (fix-code-review-suggestion)
Copilot Aug 13, 2026
b0e4946
Revert "Revert merge of PR #269 (fix-code-review-suggestion)"
JensVandewalle Aug 13, 2026
3dfa15f
Merge branch '43980_Implement-file-type-properties' of https://github…
JensVandewalle Aug 13, 2026
1ee1f67
Potential fix for pull request finding
JensVandewalle Aug 13, 2026
017393c
Commit file names only after their content is uploaded
Copilot Aug 13, 2026
f7665b4
Only contact the attachment API for collections that can hold files
Copilot Aug 13, 2026
fd7e229
Remove legacy attachment prefix stripping when parsing file property …
Copilot Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions DevPack.Tests/Properties/Values/FilePropertySettingTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
namespace RT_MediaOps.Plan.Properties.Values
{
using System;
using System.Linq;
using System.Text;

using Skyline.DataMiner.Solutions.MediaOps.Plan.API;

[TestClass]
public sealed class FilePropertySettingTests
{
private static byte[] Content(string value) => Encoding.UTF8.GetBytes(value);

[TestMethod]
public void Constructor_SetsPropertyId()
{
var id = Guid.NewGuid();

var setting = new FilePropertySetting(new FileProperty(id));

Assert.AreEqual(id, setting.Id);
}

[TestMethod]
public void Constructor_NullProperty_Throws()
{
Assert.ThrowsException<ArgumentNullException>(() => new FilePropertySetting((FileProperty)null!));
}

[TestMethod]
public void NewSetting_HasNoValue()
{
var setting = new FilePropertySetting(new FileProperty());

Assert.IsFalse(setting.HasValue);
Assert.AreEqual(0, setting.Files.Count);
}

[TestMethod]
public void AddFile_FileIsTrackedForUpload()
{
var setting = new FilePropertySetting(new FileProperty());

setting.AddFile("document.pdf", Content("abc"));

Assert.IsTrue(setting.HasValue);
CollectionAssert.AreEqual(new[] { "document.pdf" }, setting.Files.ToArray());
}

[TestMethod]
public void AddFile_StripsDirectoryInformation()
{
var setting = new FilePropertySetting(new FileProperty());

setting.AddFile(@"C:\temp\..\document.pdf", Content("abc"));

CollectionAssert.AreEqual(new[] { "document.pdf" }, setting.Files.ToArray());
}

[TestMethod]
public void AddFile_StripsUnixDirectoryInformation()
{
var setting = new FilePropertySetting(new FileProperty());

setting.AddFile("/tmp/../document.pdf", Content("abc"));

CollectionAssert.AreEqual(new[] { "document.pdf" }, setting.Files.ToArray());
}

[TestMethod]
public void AddFile_RelativeName_Throws()
{
var setting = new FilePropertySetting(new FileProperty());

Assert.ThrowsException<ArgumentException>(() => setting.AddFile("..", Content("abc")));
}

[TestMethod]
public void AddFile_SameNameTwice_KeepsSingleEntry()
{
var setting = new FilePropertySetting(new FileProperty());

setting.AddFile("document.pdf", Content("first"));
setting.AddFile("document.pdf", Content("second"));

Assert.AreEqual(1, setting.Files.Count);
}

[TestMethod]
public void AddFile_NullContent_Throws()
{
var setting = new FilePropertySetting(new FileProperty());

Assert.ThrowsException<ArgumentNullException>(() => setting.AddFile("document.pdf", null!));
}

[TestMethod]
public void AddFile_EmptyName_Throws()
{
var setting = new FilePropertySetting(new FileProperty());

Assert.ThrowsException<ArgumentException>(() => setting.AddFile(" ", Content("abc")));
}

[TestMethod]
public void AddFile_NameContainingSeparator_Throws()
{
var setting = new FilePropertySetting(new FileProperty());

Assert.ThrowsException<ArgumentException>(() => setting.AddFile("first|second.pdf", Content("abc")));
}

[TestMethod]
public void AddFile_NameContainingInvalidCharacter_Throws()
{
var setting = new FilePropertySetting(new FileProperty());

Assert.ThrowsException<ArgumentException>(() => setting.AddFile("do<cument>.pdf", Content("abc")));
}

[TestMethod]
public void RemoveFile_RemovesFile()
{
var setting = new FilePropertySetting(new FileProperty());
setting.AddFile("document.pdf", Content("abc"));

setting.RemoveFile("document.pdf");

Assert.IsFalse(setting.HasValue);
Assert.AreEqual(0, setting.Files.Count);
}

[TestMethod]
public void RemoveFile_UnknownFile_DoesNothing()
{
var setting = new FilePropertySetting(new FileProperty());
setting.AddFile("document.pdf", Content("abc"));

setting.RemoveFile("other.pdf");

CollectionAssert.AreEqual(new[] { "document.pdf" }, setting.Files.ToArray());
}

[TestMethod]
public void ClearFiles_RemovesAllFiles()
{
var setting = new FilePropertySetting(new FileProperty());
setting.AddFile("first.pdf", Content("abc"));
setting.AddFile("second.pdf", Content("def"));

setting.ClearFiles();

Assert.AreEqual(0, setting.Files.Count);
}

[TestMethod]
public void Equals_SameFiles_ReturnsTrue()
{
var property = new FileProperty(Guid.NewGuid());

var first = new FilePropertySetting(property).AddFile("a.pdf", Content("a"));
var second = new FilePropertySetting(property).AddFile("a.pdf", Content("a"));

Assert.AreEqual(first, second);
Assert.AreEqual(first.GetHashCode(), second.GetHashCode());
}

[TestMethod]
public void Equals_DifferentFiles_ReturnsFalse()
{
var property = new FileProperty(Guid.NewGuid());

var first = new FilePropertySetting(property).AddFile("a.pdf", Content("a"));
var second = new FilePropertySetting(property).AddFile("b.pdf", Content("a"));

Assert.AreNotEqual(first, second);
}

[TestMethod]
public void Equals_IgnoresFileOrder()
{
var property = new FileProperty(Guid.NewGuid());

var first = new FilePropertySetting(property).AddFile("a.pdf", Content("a")).AddFile("b.pdf", Content("b"));
var second = new FilePropertySetting(property).AddFile("b.pdf", Content("b")).AddFile("a.pdf", Content("a"));

Assert.AreEqual(first, second);
}
}
}
Loading
Loading