Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
test: extend categories test
  • Loading branch information
NRG-Drink committed May 19, 2025
commit 89ba53b0082049beb4c3811b823235eec60ec5ef
8 changes: 5 additions & 3 deletions Ical.Net.Tests/SymmetricSerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,19 @@ public static IEnumerable UriAttachment_TestCases()
yield return new TestCaseData("\\\\uncPath\\to\\resource.txt", new Uri("\\\\uncPath\\to\\resource.txt")).SetName("UNC path URL");
}

[Test]
public void CategoriesTest()
[TestCase("Foo", "Bar", "Baz")]
[TestCase("Hello", "World", null)]
public void CategoriesTest(string cat1, string cat2, string cat3)
{
var vEvent = GetSimpleEvent();
vEvent.Categories = new List<string> { "Foo", "Bar", "Baz" };
vEvent.Categories = [cat1, cat2, cat3];
var c = new Calendar();
c.Events.Add(vEvent);

var serialized = SerializeToString(c);
var categoriesCount = Regex.Matches(serialized, "CATEGORIES").Count;
Assert.That(categoriesCount, Is.EqualTo(1));
Assert.That(serialized, Does.Contain($"CATEGORIES:{string.Join(",", vEvent.Categories)}"));

var deserialized = UnserializeCalendar(serialized);
Assert.That(deserialized, Is.EqualTo(c));
Expand Down
Loading