Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to netstandard 2.0 and nodatime 3 + cleanup #499

Merged
merged 4 commits into from
Apr 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions net-core/Ical.Net.CoreUnitTests/Ical.Net.CoreUnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\IcalNetStrongnameKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="NUnit" Version="3.7.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ical.Net\Ical.Net.csproj" />
Expand Down
19 changes: 10 additions & 9 deletions net-core/Ical.Net.CoreUnitTests/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ public static void CompareComponents(ICalendarComponent cb1, ICalendarComponent
Assert.AreEqual(p1, p2, "The properties '" + p1.Name + "' are not equal.");
if (p1.Value is IComparable)
{
Assert.AreEqual(0, ((IComparable) p1.Value).CompareTo(p2.Value), "The '" + p1.Name + "' property values do not match.");
if (((IComparable)p1.Value).CompareTo(p2.Value) != 0)
continue;
}
else if (p1.Value is IEnumerable)
{
CompareEnumerables((IEnumerable) p1.Value, (IEnumerable) p2.Value, p1.Name);
CompareEnumerables((IEnumerable)p1.Value, (IEnumerable)p2.Value, p1.Name);
}
else
{
Expand Down Expand Up @@ -154,7 +155,7 @@ static Dictionary<string, string> GetValues(string serialized, string name, stri
Assert.IsTrue(match.Success, $"could not find a(n) '{name}' with value '{value}'");
return match.Groups[1].Value.Length == 0
? new Dictionary<string, string>()
: match.Groups[1].Value.Substring(1).Split(';').Select(v=>v.Split('=')).ToDictionary(v=>v[0], v=>v.Length>1 ? v[1] : null);
: match.Groups[1].Value.Substring(1).Split(';').Select(v => v.Split('=')).ToDictionary(v => v[0], v => v.Length > 1 ? v[1] : null);
}

[Test, Category("Serialization"), Ignore("TODO: standard time, for NZ standard time (current example)")]
Expand Down Expand Up @@ -184,7 +185,7 @@ public void TimeZoneSerialize()

Console.Write(serializedCalendar);

var vTimezone = InspectSerializedSection(serializedCalendar, "VTIMEZONE", new[] {"TZID:" + tz.TzId});
var vTimezone = InspectSerializedSection(serializedCalendar, "VTIMEZONE", new[] { "TZID:" + tz.TzId });
var o = tzi.BaseUtcOffset.ToString("hhmm", CultureInfo.InvariantCulture);

InspectSerializedSection(vTimezone, "STANDARD", new[] {"TZNAME:" + tzi.StandardName, "TZOFFSETTO:" + o
Expand All @@ -194,7 +195,7 @@ public void TimeZoneSerialize()
});


InspectSerializedSection(vTimezone, "DAYLIGHT", new[] {"TZNAME:" + tzi.DaylightName, "TZOFFSETFROM:" + o});
InspectSerializedSection(vTimezone, "DAYLIGHT", new[] { "TZNAME:" + tzi.DaylightName, "TZOFFSETFROM:" + o });
}
[Test, Category("Serialization")]
public void SerializeDeserialize()
Expand Down Expand Up @@ -264,7 +265,7 @@ public void EventPropertiesSerialized()
Assert.IsTrue(serializedCalendar.StartsWith("BEGIN:VCALENDAR"));
Assert.IsTrue(serializedCalendar.EndsWith("END:VCALENDAR" + SerializationConstants.LineBreak));

var expectProperties = new[] {"METHOD:PUBLISH", "VERSION:2.0"};
var expectProperties = new[] { "METHOD:PUBLISH", "VERSION:2.0" };

foreach (var p in expectProperties)
{
Expand Down Expand Up @@ -322,7 +323,7 @@ public void AttendeesSerialized()

Console.Write(serializedCalendar);

var vEvt = InspectSerializedSection(serializedCalendar, "VEVENT", new[] {"ORGANIZER:" + org});
var vEvt = InspectSerializedSection(serializedCalendar, "VEVENT", new[] { "ORGANIZER:" + org });

foreach (var a in evt.Attendees)
{
Expand Down Expand Up @@ -386,7 +387,7 @@ public void ToDoStatusAllCaps()
Status = TodoStatus.NeedsAction
};

var c = new Calendar {Todos = {component}};
var c = new Calendar { Todos = { component } };
var serialized = SerializeToString(c);
Assert.IsTrue(serialized.Contains(TodoStatus.NeedsAction, TodoStatus.Comparison));

Expand All @@ -403,7 +404,7 @@ public void JournalStatusAllCaps()
Status = JournalStatus.Final,
};

var c = new Calendar { Journals = {component} };
var c = new Calendar { Journals = { component } };
var serialized = SerializeToString(c);
Assert.IsTrue(serialized.Contains(JournalStatus.Final, JournalStatus.Comparison));

Expand Down
170 changes: 0 additions & 170 deletions net-core/Ical.Net.FrameworkUnitTests/AlarmTest.cs

This file was deleted.

94 changes: 0 additions & 94 deletions net-core/Ical.Net.FrameworkUnitTests/AttendeeTest.cs

This file was deleted.

Loading