Skip to content
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
285 changes: 140 additions & 145 deletions Ical.Net.Tests/CalDateTimeTests.cs

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Ical.Net.Tests/CalendarEventTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ public void TestGetEffectiveDuration()

var evt = new CalendarEvent()
{
DtStart = new CalDateTime(now) { HasTime = true },
DtEnd = new CalDateTime(now.AddHours(1)) { HasTime = true },
DtStart = new CalDateTime(DateOnly.FromDateTime(now), TimeOnly.FromDateTime(now)),
DtEnd = new CalDateTime(DateOnly.FromDateTime(now.AddHours(1)), TimeOnly.FromDateTime(now.AddHours(1)))
};

Assert.Multiple(() =>
Expand All @@ -491,8 +491,8 @@ public void TestGetEffectiveDuration()

evt = new CalendarEvent()
{
DtStart = new CalDateTime(now.Date) { HasTime = true },
DtEnd = new CalDateTime(now.Date.AddHours(1)) { HasTime = true },
DtStart = new CalDateTime(DateOnly.FromDateTime(now.Date), TimeOnly.FromDateTime(now.Date)),
DtEnd = new CalDateTime(DateOnly.FromDateTime(now.Date.AddHours(1)), TimeOnly.FromDateTime(now.Date.AddHours(1)))
};

Assert.Multiple(() =>
Expand All @@ -503,7 +503,7 @@ public void TestGetEffectiveDuration()

evt = new CalendarEvent()
{
DtStart = new CalDateTime(now.Date) { HasTime = false },
DtStart = new CalDateTime(DateOnly.FromDateTime(now)),
};

Assert.Multiple(() =>
Expand All @@ -514,7 +514,7 @@ public void TestGetEffectiveDuration()

evt = new CalendarEvent()
{
DtStart = new CalDateTime(now) { HasTime = true },
DtStart = new CalDateTime(DateOnly.FromDateTime(now), TimeOnly.FromDateTime(now)),
Duration = TimeSpan.FromHours(2),
};

Expand All @@ -526,7 +526,7 @@ public void TestGetEffectiveDuration()

evt = new CalendarEvent()
{
DtStart = new CalDateTime(now.Date) { HasTime = true },
DtStart = new CalDateTime(DateOnly.FromDateTime(now.Date), TimeOnly.FromDateTime(now.Date)),
Duration = TimeSpan.FromHours(2),
};

Expand All @@ -537,7 +537,7 @@ public void TestGetEffectiveDuration()

evt = new CalendarEvent()
{
DtStart = new CalDateTime(now.Date) { HasTime = false },
DtStart = new CalDateTime(DateOnly.FromDateTime(now)),
Duration = TimeSpan.FromDays(1),
};

Expand Down
27 changes: 1 addition & 26 deletions Ical.Net.Tests/ComponentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,4 @@ public void UniqueComponent1()
Assert.That(evt.Created, Is.Null); // We don't want this to be set automatically
Assert.That(evt.DtStamp, Is.Not.Null);
}

[Test, Category("Components")]
public void ChangeCalDateTimeValue()
{
var e = new CalendarEvent
{
Start = new CalDateTime(2017, 11, 22, 11, 00, 01),
End = new CalDateTime(2017, 11, 22, 11, 30, 01),
};

var firstStartAsUtc = e.Start.AsUtc;
var firstEndAsUtc = e.End.AsUtc;

e.Start.Value = new DateTime(2017, 11, 22, 11, 30, 01);
e.End.Value = new DateTime(2017, 11, 22, 12, 00, 01);

var secondStartAsUtc = e.Start.AsUtc;
var secondEndAsUtc = e.End.AsUtc;

Assert.Multiple(() =>
{
Assert.That(secondStartAsUtc, Is.Not.EqualTo(firstStartAsUtc));
Assert.That(secondEndAsUtc, Is.Not.EqualTo(firstEndAsUtc));
});
}
}
}
4 changes: 2 additions & 2 deletions Ical.Net.Tests/DeserializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ public void Google1()
var evt = iCal.Events["[email protected]"];
Assert.That(evt, Is.Not.Null);

IDateTime dtStart = new CalDateTime(2006, 12, 18, tzId);
IDateTime dtEnd = new CalDateTime(2006, 12, 23, tzId);
IDateTime dtStart = new CalDateTime(2006, 12, 18);
IDateTime dtEnd = new CalDateTime(2006, 12, 23);
var occurrences = iCal.GetOccurrences(dtStart, dtEnd).OrderBy(o => o.Period.StartTime).ToList();

var dateTimes = new[]
Expand Down
10 changes: 5 additions & 5 deletions Ical.Net.Tests/ProgramTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void Merge1()

// Get occurrences for the first event
var occurrences = evt1.GetOccurrences(
new CalDateTime(1996, 1, 1, _tzid),
new CalDateTime(2000, 1, 1, _tzid)).OrderBy(o => o.Period.StartTime).ToList();
new CalDateTime(1996, 1, 1),
new CalDateTime(2000, 1, 1)).OrderBy(o => o.Period.StartTime).ToList();

var dateTimes = new[]
{
Expand Down Expand Up @@ -104,8 +104,8 @@ public void Merge1()

// Get occurrences for the 2nd event
occurrences = evt2.GetOccurrences(
new CalDateTime(1996, 1, 1, _tzid),
new CalDateTime(1998, 4, 1, _tzid)).OrderBy(o => o.Period.StartTime).ToList();
new CalDateTime(1996, 1, 1),
new CalDateTime(1998, 4, 1)).OrderBy(o => o.Period.StartTime).ToList();

var dateTimes1 = new[]
{
Expand Down Expand Up @@ -180,4 +180,4 @@ public void SystemTimeZone3()
}, Throws.Nothing, "Time zone should be found.");
}
}
}
}
Loading
Loading