Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Ical.Net.Tests/CalendarEventTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ public void EventResourcesCanBeZeroedOut()
Assert.That(e.Resources.Any(r => resources.Contains(r)), Is.False);
});

e.Resources = null;
//See https://github.com/rianjs/ical.net/issues/208 -- this should be changed later so the collection is really null
//See https://github.com/rianjs/ical.net/issues/208
e.Resources = Array.Empty<string>();
Assert.That(e.Resources?.Count, Is.EqualTo(0));
}

Expand Down
12 changes: 7 additions & 5 deletions Ical.Net.Tests/ComponentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
// Licensed under the MIT license.
//

using System;
#nullable enable
using Ical.Net.CalendarComponents;
using Ical.Net.DataTypes;
using NUnit.Framework;

namespace Ical.Net.Tests;
Expand All @@ -18,8 +17,11 @@ public void UniqueComponent1()
var iCal = new Calendar();
var evt = iCal.Create<CalendarEvent>();

Assert.That(evt.Uid, Is.Not.Null);
Assert.That(evt.Created, Is.Null); // We don't want this to be set automatically
Assert.That(evt.DtStamp, Is.Not.Null);
Assert.Multiple(() =>
{
Assert.That(evt.Uid, Is.Not.Null);
Assert.That(evt.Created, Is.Null); // We don't want this to be set automatically
Assert.That(evt.DtStamp, Is.Not.Null);
});
}
}
2 changes: 1 addition & 1 deletion Ical.Net.Tests/CopyComponentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class CopyComponentTests
[Test, TestCaseSource(nameof(CopyCalendarTest_TestCases)), Category("Copy tests")]
public void CopyCalendarTest(string calendarString)
{
var iCal1 = Calendar.Load(calendarString);
var iCal1 = Calendar.Load(calendarString)!;
var iCal2 = iCal1.Copy<Calendar>();
SerializationTests.CompareCalendars(iCal1, iCal2);
}
Expand Down
9 changes: 5 additions & 4 deletions Ical.Net.Tests/FreeBusyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Licensed under the MIT license.
//

#nullable enable
using Ical.Net.CalendarComponents;
using Ical.Net.DataTypes;
using NUnit.Framework;
Expand All @@ -18,14 +19,14 @@ public class FreeBusyTest
[Test, Category("FreeBusy")]
public void GetFreeBusyStatus1()
{
Calendar cal = new Calendar();
var cal = new Calendar();

CalendarEvent evt = cal.Create<CalendarEvent>();
var evt = cal.Create<CalendarEvent>();
evt.Summary = "Test event";
evt.Start = new CalDateTime(2010, 10, 1, 8, 0, 0);
evt.End = new CalDateTime(2010, 10, 1, 9, 0, 0);

var freeBusy = cal.GetFreeBusy(new CalDateTime(2010, 10, 1, 0, 0, 0), new CalDateTime(2010, 10, 7, 11, 59, 59));
var freeBusy = cal.GetFreeBusy(new CalDateTime(2010, 10, 1, 0, 0, 0), new CalDateTime(2010, 10, 7, 11, 59, 59))!;
Assert.Multiple(() =>
{
Assert.That(freeBusy.GetFreeBusyStatus(new CalDateTime(2010, 10, 1, 7, 59, 59)), Is.EqualTo(FreeBusyStatus.Free));
Expand All @@ -34,4 +35,4 @@ public void GetFreeBusyStatus1()
Assert.That(freeBusy.GetFreeBusyStatus(new CalDateTime(2010, 10, 1, 9, 0, 0)), Is.EqualTo(FreeBusyStatus.Free));
});
}
}
}
4 changes: 2 additions & 2 deletions Ical.Net.Tests/PeriodListWrapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ public void AddRPeriod_ShouldCreate_DedicatePeriodList()
var serializer = new CalendarSerializer(cal);
var serialized = serializer.SerializeToString();
// Assign the deserialized event
cal = Calendar.Load(serialized);
cal = Calendar.Load(serialized)!;
evt = cal.Events[0];

// Assert the serialized string and the deserialized event
Assert.Multiple(() =>
{
// 2 dedicate PeriodList objects
Assert.That(evt.RecurrenceDatesPeriodLists, Has.Count.EqualTo(3));
Assert.That(evt!.RecurrenceDatesPeriodLists, Has.Count.EqualTo(3));

// First PeriodList has date-only periods
Assert.That(evt.RecurrenceDatesPeriodLists[0], Has.Count.EqualTo(3));
Expand Down
6 changes: 3 additions & 3 deletions Ical.Net.Tests/ProgramTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public static void TestCal(Calendar cal)
[Test]
public void Merge1()
{
var iCal1 = Calendar.Load(IcsFiles.MonthlyCountByMonthDay3);
var iCal2 = Calendar.Load(IcsFiles.MonthlyByDay1);
var iCal1 = Calendar.Load(IcsFiles.MonthlyCountByMonthDay3)!;
var iCal2 = Calendar.Load(IcsFiles.MonthlyByDay1)!;

// Change the UID of the 2nd event to make sure it's different
iCal2.Events[iCal1.Events[0].Uid].Uid = "1234567890";
iCal2.Events[iCal1.Events[0].Uid!].Uid = "1234567890";
iCal1.MergeWith(iCal2);

var evt1 = iCal1.Events.First();
Expand Down
Loading
Loading