-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added BuyWindows to Session models as computed fields
- Loading branch information
1 parent
3845ffe
commit 3b82c1a
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using HockeyPickup.Api.Models.Responses; | ||
|
||
namespace HockeyPickup.Api.Tests.ModelTests; | ||
|
||
public class SessionDetailedResponseTests | ||
{ | ||
[Fact] | ||
public void BuyWindow_ShouldReturnCorrectDateTime() | ||
{ | ||
// Arrange | ||
var sessionDate = new DateTime(2025, 2, 25, 7, 30, 0); | ||
var buyDayMinimum = 6; | ||
var expectedBuyWindow = new DateTime(2025, 2, 19, 9, 30, 0); | ||
|
||
var session = new SessionDetailedResponse | ||
{ | ||
SessionId = 1, | ||
CreateDateTime = DateTime.Now, | ||
UpdateDateTime = DateTime.Now, | ||
SessionDate = sessionDate, | ||
BuyDayMinimum = buyDayMinimum | ||
}; | ||
|
||
// Act | ||
var actualBuyWindow = session.BuyWindow; | ||
|
||
// Assert | ||
Assert.Equal(expectedBuyWindow, actualBuyWindow); | ||
} | ||
|
||
[Fact] | ||
public void BuyWindowPreferred_ShouldReturnCorrectDateTime() | ||
{ | ||
// Arrange | ||
var sessionDate = new DateTime(2025, 2, 25, 7, 30, 0); | ||
var buyDayMinimum = 6; | ||
var expectedBuyWindowPreferred = new DateTime(2025, 2, 18, 9, 30, 0); | ||
|
||
var session = new SessionDetailedResponse | ||
{ | ||
SessionId = 1, | ||
CreateDateTime = DateTime.Now, | ||
UpdateDateTime = DateTime.Now, | ||
SessionDate = sessionDate, | ||
BuyDayMinimum = buyDayMinimum | ||
}; | ||
|
||
// Act | ||
var actualBuyWindowPreferred = session.BuyWindowPreferred; | ||
|
||
// Assert | ||
Assert.Equal(expectedBuyWindowPreferred, actualBuyWindowPreferred); | ||
} | ||
|
||
[Fact] | ||
public void BuyWindowPreferredPlus_ShouldReturnCorrectDateTime() | ||
{ | ||
// Arrange | ||
var sessionDate = new DateTime(2025, 2, 25, 7, 30, 0); | ||
var buyDayMinimum = 6; | ||
var expectedBuyWindowPreferredPlus = new DateTime(2025, 2, 18, 9, 25, 0); | ||
|
||
var session = new SessionDetailedResponse | ||
{ | ||
SessionId = 1, | ||
CreateDateTime = DateTime.Now, | ||
UpdateDateTime = DateTime.Now, | ||
SessionDate = sessionDate, | ||
BuyDayMinimum = buyDayMinimum | ||
}; | ||
|
||
// Act | ||
var actualBuyWindowPreferredPlus = session.BuyWindowPreferredPlus; | ||
|
||
// Assert | ||
Assert.Equal(expectedBuyWindowPreferredPlus, actualBuyWindowPreferredPlus); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters