-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-469: Add new enum type for extended comment sort order
- Loading branch information
1 parent
350b8ae
commit ff69965
Showing
4 changed files
with
130 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
Source/Lib/Trakt.NET/Enums/TraktExtendedCommentSortOrder.cs
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,42 @@ | ||
namespace TraktNet.Enums | ||
{ | ||
/// <summary>Determines the sort order for comments.</summary> | ||
public sealed class TraktExtendedCommentSortOrder : TraktEnumeration | ||
{ | ||
/// <summary>An invalid sort order.</summary> | ||
public static TraktExtendedCommentSortOrder Unspecified { get; } = new TraktExtendedCommentSortOrder(); | ||
|
||
/// <summary>Comments will be sorted by newest comments first.</summary> | ||
public static TraktExtendedCommentSortOrder Newest { get; } = new TraktExtendedCommentSortOrder(1, "newest", "newest", "Newest"); | ||
|
||
/// <summary>Comments will be sorted by oldest comments first.</summary> | ||
public static TraktExtendedCommentSortOrder Oldest { get; } = new TraktExtendedCommentSortOrder(2, "oldest", "oldest", "Oldest"); | ||
|
||
/// <summary>Comments will be sorted by the number of likes first.</summary> | ||
public static TraktExtendedCommentSortOrder Likes { get; } = new TraktExtendedCommentSortOrder(4, "likes", "likes", "Likes"); | ||
|
||
/// <summary>Comments will be sorted by the number of replies first.</summary> | ||
public static TraktExtendedCommentSortOrder Replies { get; } = new TraktExtendedCommentSortOrder(8, "replies", "replies", "Replies"); | ||
|
||
/// <summary>Comments will be sorted by highest comments first.</summary> | ||
public static TraktExtendedCommentSortOrder Highest { get; } = new TraktExtendedCommentSortOrder(16, "highest", "highest", "Highest"); | ||
|
||
/// <summary>Comments will be sorted by lowest comments first.</summary> | ||
public static TraktExtendedCommentSortOrder Lowest { get; } = new TraktExtendedCommentSortOrder(32, "lowest", "lowest", "Lowest"); | ||
|
||
/// <summary>Comments will be sorted by the number of plays first.</summary> | ||
public static TraktExtendedCommentSortOrder Plays { get; } = new TraktExtendedCommentSortOrder(64, "plays", "plays", "Plays"); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TraktExtendedCommentSortOrder" /> class.<para /> | ||
/// The initialized <see cref="TraktExtendedCommentSortOrder" /> is invalid. | ||
/// </summary> | ||
public TraktExtendedCommentSortOrder() | ||
{ | ||
} | ||
|
||
public TraktExtendedCommentSortOrder(int value, string objectName, string uriName, string displayName) : base(value, objectName, uriName, displayName) | ||
{ | ||
} | ||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
Source/Tests/Trakt.NET.Core.Tests/Enums/TraktExtendedCommentSortOrder_Tests.cs
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,63 @@ | ||
namespace TraktNet.Core.Tests.Enums | ||
{ | ||
using FluentAssertions; | ||
using System.Collections.Generic; | ||
using Trakt.NET.Tests.Utility.Traits; | ||
using TraktNet.Enums; | ||
using Xunit; | ||
|
||
[TestCategory("Enums")] | ||
public class TraktExtendedCommentSortOrder_Tests | ||
{ | ||
[Fact] | ||
public void Test_TraktExtendedCommentSortOrder_GetAll() | ||
{ | ||
var allValues = TraktEnumeration.GetAll<TraktExtendedCommentSortOrder>(); | ||
|
||
allValues.Should().NotBeNull().And.HaveCount(8); | ||
allValues.Should().Contain(new List<TraktExtendedCommentSortOrder>() { TraktExtendedCommentSortOrder.Unspecified, TraktExtendedCommentSortOrder.Newest, | ||
TraktExtendedCommentSortOrder.Oldest, TraktExtendedCommentSortOrder.Likes, | ||
TraktExtendedCommentSortOrder.Replies, TraktExtendedCommentSortOrder.Highest, | ||
TraktExtendedCommentSortOrder.Lowest, TraktExtendedCommentSortOrder.Plays }); | ||
} | ||
|
||
[Fact] | ||
public void Test_TraktExtendedCommentSortOrder_Properties() | ||
{ | ||
TraktExtendedCommentSortOrder.Newest.Value.Should().Be(1); | ||
TraktExtendedCommentSortOrder.Newest.ObjectName.Should().Be("newest"); | ||
TraktExtendedCommentSortOrder.Newest.UriName.Should().Be("newest"); | ||
TraktExtendedCommentSortOrder.Newest.DisplayName.Should().Be("Newest"); | ||
|
||
TraktExtendedCommentSortOrder.Oldest.Value.Should().Be(2); | ||
TraktExtendedCommentSortOrder.Oldest.ObjectName.Should().Be("oldest"); | ||
TraktExtendedCommentSortOrder.Oldest.UriName.Should().Be("oldest"); | ||
TraktExtendedCommentSortOrder.Oldest.DisplayName.Should().Be("Oldest"); | ||
|
||
TraktExtendedCommentSortOrder.Likes.Value.Should().Be(4); | ||
TraktExtendedCommentSortOrder.Likes.ObjectName.Should().Be("likes"); | ||
TraktExtendedCommentSortOrder.Likes.UriName.Should().Be("likes"); | ||
TraktExtendedCommentSortOrder.Likes.DisplayName.Should().Be("Likes"); | ||
|
||
TraktExtendedCommentSortOrder.Replies.Value.Should().Be(8); | ||
TraktExtendedCommentSortOrder.Replies.ObjectName.Should().Be("replies"); | ||
TraktExtendedCommentSortOrder.Replies.UriName.Should().Be("replies"); | ||
TraktExtendedCommentSortOrder.Replies.DisplayName.Should().Be("Replies"); | ||
|
||
TraktExtendedCommentSortOrder.Highest.Value.Should().Be(16); | ||
TraktExtendedCommentSortOrder.Highest.ObjectName.Should().Be("highest"); | ||
TraktExtendedCommentSortOrder.Highest.UriName.Should().Be("highest"); | ||
TraktExtendedCommentSortOrder.Highest.DisplayName.Should().Be("Highest"); | ||
|
||
TraktExtendedCommentSortOrder.Lowest.Value.Should().Be(32); | ||
TraktExtendedCommentSortOrder.Lowest.ObjectName.Should().Be("lowest"); | ||
TraktExtendedCommentSortOrder.Lowest.UriName.Should().Be("lowest"); | ||
TraktExtendedCommentSortOrder.Lowest.DisplayName.Should().Be("Lowest"); | ||
|
||
TraktExtendedCommentSortOrder.Plays.Value.Should().Be(64); | ||
TraktExtendedCommentSortOrder.Plays.ObjectName.Should().Be("plays"); | ||
TraktExtendedCommentSortOrder.Plays.UriName.Should().Be("plays"); | ||
TraktExtendedCommentSortOrder.Plays.DisplayName.Should().Be("Plays"); | ||
} | ||
} | ||
} |