diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-11 15:34:59 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-11 15:34:59 +0800 |
commit | 26392cdd2028eff2132948d5cc5e36e08a2d69a9 (patch) | |
tree | 233518dd41d7747c8932eac67d48a62aa4203d53 /Timeline.Tests/Helpers/UserInfoComparers.cs | |
parent | 38ff45fcc0b58a95ad52ba43a8be4ff466694269 (diff) | |
download | timeline-26392cdd2028eff2132948d5cc5e36e08a2d69a9.tar.gz timeline-26392cdd2028eff2132948d5cc5e36e08a2d69a9.tar.bz2 timeline-26392cdd2028eff2132948d5cc5e36e08a2d69a9.zip |
Add FluentAssertions.
Diffstat (limited to 'Timeline.Tests/Helpers/UserInfoComparers.cs')
-rw-r--r-- | Timeline.Tests/Helpers/UserInfoComparers.cs | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/Timeline.Tests/Helpers/UserInfoComparers.cs b/Timeline.Tests/Helpers/UserInfoComparers.cs deleted file mode 100644 index 1a1c652d..00000000 --- a/Timeline.Tests/Helpers/UserInfoComparers.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Collections.Generic;
-using Timeline.Models;
-
-namespace Timeline.Tests.Helpers
-{
- public static class UserInfoComparers
- {
- public static IEqualityComparer<UserInfo> EqualityComparer { get; } = new EqualityComparerImpl();
- public static IComparer<UserInfo> Comparer { get; } = Comparer<UserInfo>.Create(Compare);
-
-
- private class EqualityComparerImpl : IEqualityComparer<UserInfo>
- {
- bool IEqualityComparer<UserInfo>.Equals(UserInfo x, UserInfo y)
- {
- return Compare(x, y) == 0;
- }
-
- int IEqualityComparer<UserInfo>.GetHashCode(UserInfo obj)
- {
- return obj.Username.GetHashCode() ^ obj.Administrator.GetHashCode();
- }
- }
-
- public static int Compare(UserInfo left, UserInfo right)
- {
- if (left == null)
- {
- if (right == null)
- return 0;
- return -1;
- }
-
- if (right == null)
- return 1;
-
- var uc = string.Compare(left.Username, right.Username);
- if (uc != 0)
- return uc;
-
- if (left.Administrator == right.Administrator)
- return 0;
-
- return left.Administrator ? -1 : 1;
- }
- }
-}
|