Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar committed Dec 3, 2024
1 parent 42e2050 commit 66e1a4e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
using AdminWebsite.Contracts.Responses;
using AdminWebsite.Extensions;

namespace AdminWebsite.UnitTests.Extensions
{
public class HearingDetailsResponseExtensionsTests
{
[SetUp]
public void Setup()
[Test]
public void HasScheduleAmended__True_WhenDatesHaveChanged()
{
new HearingDetailsResponse
var hearing = new HearingDetailsResponse
{
Id = Guid.NewGuid(),
Participants = new List<ParticipantResponse>()
ScheduledDateTime = DateTime.UtcNow
};
var anotherHearing = new HearingDetailsResponse
{
ScheduledDateTime = DateTime.UtcNow.AddHours(1)
};

var result = hearing.HasScheduleAmended(anotherHearing);

result.Should().BeTrue();
}

[Test]
public void HasScheduleAmended__False_WhenDatesAreTheSame()
{
var now = DateTime.UtcNow;
var hearing = new HearingDetailsResponse
{
ScheduledDateTime = now
};
var anotherHearing = new HearingDetailsResponse
{
ScheduledDateTime = now
};

var result = hearing.HasScheduleAmended(anotherHearing);

result.Should().BeFalse();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace AdminWebsite.Extensions;
public static class HearingDetailsResponseExtensions
{
public static bool HasScheduleAmended(this HearingDetailsResponse hearing, HearingDetailsResponse anotherHearing)

{
return hearing.ScheduledDateTime.Ticks != anotherHearing.ScheduledDateTime.Ticks;
}
Expand Down

0 comments on commit 66e1a4e

Please sign in to comment.