Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 6366921

Browse files
committed
Fix tests that used Program
Needed to substitute for Program a bit better.
1 parent 1ea2682 commit 6366921

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/GitHub.Api.UnitTests/SimpleApiClientFactoryTests.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class TheCreateMethod
1616
public async Task CreatesNewInstanceOfSimpleApiClient()
1717
{
1818
const string url = "https://github.com/github/CreatesNewInstanceOfSimpleApiClient";
19-
var program = Substitute.For<IProgram>();
19+
var program = CreateProgram();
2020
var keychain = Substitute.For<IKeychain>();
2121
var enterpriseProbe = Substitute.For<IEnterpriseProbe>();
2222
var wikiProbe = Substitute.For<IWikiProbe>();
@@ -40,7 +40,7 @@ public class TheClearFromCacheMethod
4040
public async Task RemovesClientFromCache()
4141
{
4242
const string url = "https://github.com/github/RemovesClientFromCache";
43-
var program = Substitute.For<IProgram>();
43+
var program = CreateProgram();
4444
var enterpriseProbe = Substitute.For<IEnterpriseProbe>();
4545
var wikiProbe = Substitute.For<IWikiProbe>();
4646
var factory = new SimpleApiClientFactory(
@@ -56,6 +56,13 @@ public async Task RemovesClientFromCache()
5656
}
5757
}
5858

59+
static IProgram CreateProgram()
60+
{
61+
var program = Substitute.For<IProgram>();
62+
program.ProductHeader.Returns(new ProductHeaderValue("ProductName"));
63+
return program;
64+
}
65+
5966
static IKeychain CreateKeychain()
6067
{
6168
var result = Substitute.For<IKeychain>();

0 commit comments

Comments
 (0)