File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,23 @@ namespace SmartSql.Test.Unit.Cache
55 public class CachedEntity
66 {
77 public string Name { get ; set ; }
8+
9+ protected bool Equals ( CachedEntity other )
10+ {
11+ return Name == other . Name ;
12+ }
13+
14+ public override bool Equals ( object obj )
15+ {
16+ if ( ReferenceEquals ( null , obj ) ) return false ;
17+ if ( ReferenceEquals ( this , obj ) ) return true ;
18+ if ( obj . GetType ( ) != this . GetType ( ) ) return false ;
19+ return Equals ( ( CachedEntity ) obj ) ;
20+ }
21+
22+ public override int GetHashCode ( )
23+ {
24+ return ( Name != null ? Name . GetHashCode ( ) : 0 ) ;
25+ }
826 }
927}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public void GetByCacheFromRequest()
4747 SqlId = "GetByCacheFromRequest" ,
4848 Request = new { CacheKey = "CacheKey" }
4949 } ) ;
50- Assert . Equal ( list . GetHashCode ( ) , cachedList . GetHashCode ( ) ) ;
50+ Assert . Equal ( list , cachedList ) ;
5151 }
5252 }
5353}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public UsedCacheRepositoryTest(SmartSqlFixture smartSqlFixture)
1919 public void GetNow ( )
2020 {
2121 var datetime = _usedCacheRepository . GetNow ( ) ;
22- Thread . Sleep ( 1000 ) ;
22+ Thread . Sleep ( 2000 ) ;
2323 var datetime1 = _usedCacheRepository . GetNow ( ) ;
2424 Assert . Equal ( datetime , datetime1 ) ;
2525 }
You can’t perform that action at this time.
0 commit comments