-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from The-Poolz/update-to-version-1.3.2
Update to version 1.3.2
- Loading branch information
Showing
6 changed files
with
62 additions
and
11 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
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,38 @@ | ||
using Xunit; | ||
using System.Text.Json; | ||
|
||
namespace QuickSQL.Tests.Requests | ||
{ | ||
public static class OrderRuleTests | ||
{ | ||
[Fact] | ||
public static void CreateOrderRule() | ||
{ | ||
var orederRule = new OrderRule(); | ||
|
||
Assert.NotNull(orederRule); | ||
Assert.IsType<OrderRule>(orederRule); | ||
} | ||
|
||
[Fact] | ||
public static void CreateOrderRuleWithParams() | ||
{ | ||
var orederRule = new OrderRule("Id", SortBy.DESC); | ||
|
||
Assert.NotNull(orederRule); | ||
Assert.IsType<OrderRule>(orederRule); | ||
} | ||
|
||
[Fact] | ||
public static void SerializeObject() | ||
{ | ||
var orederRule = new OrderRule("Id", SortBy.DESC); | ||
|
||
var result = JsonSerializer.Serialize(orederRule); | ||
|
||
Assert.NotNull(result); | ||
Assert.IsType<string>(result); | ||
Assert.Equal("{\"ColumnName\":\"Id\",\"Sort\":1}", result); | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,13 +1,33 @@ | ||
namespace QuickSQL | ||
{ | ||
/// <summary> | ||
/// This class is an object that combines the name of the sorted column and the sorting direction. | ||
/// </summary> | ||
public class OrderRule | ||
{ | ||
/// <summary> | ||
/// Don't use this, as object parameters are only set on initialization.<br/> | ||
/// This constructor for JSON serializing. | ||
/// </summary> | ||
public OrderRule() { } | ||
/// <summary> | ||
/// Create a order rule. | ||
/// </summary> | ||
/// <param name="columnName">Enter the name of the column to be sorted.</param> | ||
/// <param name="sort">Enter <see cref="SortBy"/> to customize sorting.<br/> | ||
/// Default value: <see cref="SortBy.ASC"/> </param> | ||
public OrderRule(string columnName, SortBy sort = SortBy.ASC) | ||
{ | ||
ColumnName = columnName; | ||
Sort = sort; | ||
} | ||
/// <summary> | ||
/// The name of the column that will be sorted. | ||
/// </summary> | ||
public string ColumnName { get; init; } | ||
/// <summary> | ||
/// Sorting direction. Default value: <see cref="SortBy.ASC"/> | ||
/// </summary> | ||
public SortBy Sort { get; init; } | ||
} | ||
} |
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