diff --git a/backend/Testing/LexCore/Services/HgServiceTests.cs b/backend/Testing/LexCore/Services/HgServiceTests.cs index dae6f7a4b..502b0a3b1 100644 --- a/backend/Testing/LexCore/Services/HgServiceTests.cs +++ b/backend/Testing/LexCore/Services/HgServiceTests.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Moq; +using Moq.Contrib.HttpClient; using Shouldly; using Testing.Fixtures; @@ -30,8 +31,16 @@ public HgServiceTests() HgResumableUrl = LexboxResumable, SendReceiveDomain = LexboxHgWeb }; + var handler = new Mock(MockBehavior.Strict); + + // This may need to become more sophisticated if our FinishReset tests are changed to include + // a Mercurial repo with actual commits in it, but this is good enough at the moment. + var AllZeroHash = "0000000000000000000000000000000000000000"; + handler.SetupAnyRequest().ReturnsResponse(AllZeroHash); + + var mockFactory = handler.CreateClientFactory(); _hgService = new HgService(new OptionsWrapper(_hgConfig), - Mock.Of(), + mockFactory, NullLogger.Instance); CleanUpTempDir(); } @@ -53,9 +62,9 @@ public void DetermineProjectPrefixWorks(HgType type, string expectedUrl) HgService.DetermineProjectUrlPrefix(type, _hgConfig).ShouldBe(expectedUrl); } - // [Theory] - // [InlineData(".hg/important-file.bin")] - // [InlineData("unzip-test/.hg/important-file.bin")] + [Theory] + [InlineData(".hg/important-file.bin")] + [InlineData("unzip-test/.hg/important-file.bin")] public async Task CanFinishResetByUnZippingAnArchive(string filePath) { // arrange @@ -98,7 +107,7 @@ private void CreateSimpleEntry(ZipArchive zipArchive, string filePath) fileStream.Flush(); } - // [Fact] + [Fact] public async Task ThrowsIfNoHgFolderIsFound() { var code = "unzip-test-no-hg"; diff --git a/backend/Testing/Testing.csproj b/backend/Testing/Testing.csproj index 57b5d8306..e72fb0a75 100644 --- a/backend/Testing/Testing.csproj +++ b/backend/Testing/Testing.csproj @@ -15,6 +15,7 @@ +