Skip to content

Commit 7eba13d

Browse files
committed
Move AssertReflogEntryIsCreated to BaseFixture
1 parent 5331dea commit 7eba13d

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

LibGit2Sharp.Tests/ReferenceFixture.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -778,20 +778,5 @@ public void CanIdentifyReferenceKind()
778778
Assert.True(repo.Refs["refs/notes/commits"].IsNote());
779779
}
780780
}
781-
782-
private static void AssertReflogEntryIsCreated(IEnumerable<ReflogEntry> reflog, string targetSha, string logMessage, string fromSha = null)
783-
{
784-
var reflogEntry = reflog.First();
785-
786-
if (!string.IsNullOrEmpty(fromSha))
787-
{
788-
Assert.Equal(fromSha, reflogEntry.From.Sha);
789-
}
790-
791-
Assert.Equal(targetSha, reflogEntry.To.Sha);
792-
Assert.NotNull(reflogEntry.Commiter.Email);
793-
Assert.NotNull(reflogEntry.Commiter.Name);
794-
Assert.Equal(logMessage, reflogEntry.Message);
795-
}
796781
}
797782
}

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Text;
56
using System.Text.RegularExpressions;
67
using LibGit2Sharp.Core;
@@ -221,5 +222,21 @@ protected string Touch(string parent, string file, string content = null)
221222

222223
return file;
223224
}
225+
226+
protected static void AssertReflogEntryIsCreated(IEnumerable<ReflogEntry> reflog, string targetSha,
227+
string logMessage, string fromSha = null)
228+
{
229+
var reflogEntry = reflog.First();
230+
231+
if (!string.IsNullOrEmpty(fromSha))
232+
{
233+
Assert.Equal(fromSha, reflogEntry.From.Sha);
234+
}
235+
236+
Assert.Equal(targetSha, reflogEntry.To.Sha);
237+
Assert.NotNull(reflogEntry.Commiter.Email);
238+
Assert.NotNull(reflogEntry.Commiter.Name);
239+
Assert.Equal(logMessage, reflogEntry.Message);
240+
}
224241
}
225242
}

0 commit comments

Comments
 (0)