diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-11 16:12:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-11 16:12:23 +0800 |
commit | 285fe070388e48d82f008c3de5b0d7675f55ebfa (patch) | |
tree | 3e4e7de38b9f0e5832923a6bc1ce7872fc4370a5 /Timeline.Tests/Helpers/UserInfoComparers.cs | |
parent | 38ff45fcc0b58a95ad52ba43a8be4ff466694269 (diff) | |
parent | 4b0d4ba4e79c1a2e22ccf131d1abdbf113d78b6a (diff) | |
download | timeline-285fe070388e48d82f008c3de5b0d7675f55ebfa.tar.gz timeline-285fe070388e48d82f008c3de5b0d7675f55ebfa.tar.bz2 timeline-285fe070388e48d82f008c3de5b0d7675f55ebfa.zip |
Merge pull request #39 from crupest/fluent-assertion
Use 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;
- }
- }
-}
|