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 | ac072939e727181f79e3d6d1acd7d7ac1f4c29f6 (patch) | |
tree | 3e4e7de38b9f0e5832923a6bc1ce7872fc4370a5 /Timeline.Tests/Helpers/UserInfoComparers.cs | |
parent | d97185e6152a327f6ef3b1873bfd86f1a3aac3a1 (diff) | |
parent | 6f4924af35e4620ccf11145e28be9490773155f6 (diff) | |
download | timeline-ac072939e727181f79e3d6d1acd7d7ac1f4c29f6.tar.gz timeline-ac072939e727181f79e3d6d1acd7d7ac1f4c29f6.tar.bz2 timeline-ac072939e727181f79e3d6d1acd7d7ac1f4c29f6.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;
- }
- }
-}
|