-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AsValueEnumerable() to replace the bindings
- Loading branch information
Showing
150 changed files
with
2,821 additions
and
5,073 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
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
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
68 changes: 68 additions & 0 deletions
68
NetFabric.Hyperlinq.UnitTests/Aggregation/Sum/Sum.ReadOnlyList.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,68 @@ | ||
using NetFabric.Assertive; | ||
using System; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
namespace NetFabric.Hyperlinq.UnitTests.Aggregation.Sum | ||
{ | ||
public class ReadOnlyListTests | ||
{ | ||
public static TheoryData<int[]> Sum => | ||
new TheoryData<int[]> | ||
{ | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7 } }, | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7, 8 } }, | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } }, | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 } }, | ||
}; | ||
|
||
|
||
[Theory] | ||
[MemberData(nameof(TestData.Empty), MemberType = typeof(TestData))] | ||
[MemberData(nameof(TestData.Single), MemberType = typeof(TestData))] | ||
[MemberData(nameof(TestData.Multiple), MemberType = typeof(TestData))] | ||
[MemberData(nameof(Sum))] | ||
public void Sum_With_ValidData_Must_Succeed(int[] source) | ||
{ | ||
// Arrange | ||
var wrapped = Wrap.AsList(source); | ||
var expected = Enumerable | ||
.Sum(source); | ||
|
||
// Act | ||
var result = wrapped.AsValueEnumerable() | ||
.Sum(); | ||
|
||
// Assert | ||
_ = result.Must() | ||
.BeEqualTo(expected); | ||
} | ||
|
||
public static TheoryData<int?[]> NullableSum => | ||
new TheoryData<int?[]> | ||
{ | ||
{ new int?[] { null } }, | ||
{ new int?[] { null, null, null } }, | ||
{ new int?[] { null, 2, 3, 4, null } }, | ||
{ new int?[] { 1, 2, null, 4, 5 } }, | ||
}; | ||
|
||
[Theory] | ||
[MemberData(nameof(NullableSum))] | ||
public void Sum_With_Nullable_ValidData_Must_Succeed(int?[] source) | ||
{ | ||
// Arrange | ||
var wrapped = Wrap.AsList(source); | ||
var expected = Enumerable | ||
.Sum(source); | ||
|
||
// Act | ||
var result = wrapped.AsValueEnumerable() | ||
.Sum(); | ||
|
||
// Assert | ||
_ = result.Must() | ||
.BeEqualTo(expected.Value); | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
NetFabric.Hyperlinq.UnitTests/Aggregation/Sum/Sum.ValueEnumerable.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,68 @@ | ||
using NetFabric.Assertive; | ||
using System; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
namespace NetFabric.Hyperlinq.UnitTests.Aggregation.Sum | ||
{ | ||
public class ValueEnumerableTests | ||
{ | ||
public static TheoryData<int[]> Sum => | ||
new TheoryData<int[]> | ||
{ | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7 } }, | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7, 8 } }, | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } }, | ||
{ new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 } }, | ||
}; | ||
|
||
|
||
[Theory] | ||
[MemberData(nameof(TestData.Empty), MemberType = typeof(TestData))] | ||
[MemberData(nameof(TestData.Single), MemberType = typeof(TestData))] | ||
[MemberData(nameof(TestData.Multiple), MemberType = typeof(TestData))] | ||
[MemberData(nameof(Sum))] | ||
public void Sum_With_ValidData_Must_Succeed(int[] source) | ||
{ | ||
// Arrange | ||
var wrapped = Wrap.AsValueEnumerable(source); | ||
var expected = Enumerable | ||
.Sum(source); | ||
|
||
// Act | ||
var result = wrapped.AsValueEnumerable() | ||
.Sum(); | ||
|
||
// Assert | ||
_ = result.Must() | ||
.BeEqualTo(expected); | ||
} | ||
|
||
public static TheoryData<int?[]> NullableSum => | ||
new TheoryData<int?[]> | ||
{ | ||
{ new int?[] { null } }, | ||
{ new int?[] { null, null, null } }, | ||
{ new int?[] { null, 2, 3, 4, null } }, | ||
{ new int?[] { 1, 2, null, 4, 5 } }, | ||
}; | ||
|
||
[Theory] | ||
[MemberData(nameof(NullableSum))] | ||
public void Sum_With_Nullable_ValidData_Must_Succeed(int?[] source) | ||
{ | ||
// Arrange | ||
var wrapped = Wrap.AsList(source); | ||
var expected = Enumerable | ||
.Sum(source); | ||
|
||
// Act | ||
var result = wrapped.AsValueEnumerable() | ||
.Sum(); | ||
|
||
// Assert | ||
_ = result.Must() | ||
.BeEqualTo(expected.Value); | ||
} | ||
} | ||
} |
Oops, something went wrong.