Skip to content

Commit

Permalink
Merge pull request #44 from firebase/hkj-fix-build
Browse files Browse the repository at this point in the history
Fixing a build error in tests
  • Loading branch information
hiranya911 authored Apr 15, 2019
2 parents 43bdc3c + 9023282 commit 5e5a7d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

-
- [added] `AppOptions` now supports setting an `HttpClientFactory`, which
is useful when deploying the SDK behind a proxy server.

# v1.3.0

Expand Down
4 changes: 2 additions & 2 deletions FirebaseAdmin/FirebaseAdmin.Tests/FirebaseAppTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void CreateAppOptions()
Assert.Same(credential, copy.Credential);
Assert.Equal("test-project", copy.ProjectId);
Assert.Equal("[email protected]", copy.ServiceAccountId);
Assert.Same(typeof(MockHttpClientFactory), copy.HttpClientFactory.GetType());
Assert.Same(copy.HttpClientFactory, options.HttpClientFactory);
}

[Fact]
Expand All @@ -125,7 +125,7 @@ public void CreateAppOptionsNoClientFactory()
Assert.Same(credential, copy.Credential);
Assert.Equal("test-project", copy.ProjectId);
Assert.Equal("[email protected]", copy.ServiceAccountId);
Assert.Same(typeof(HttpClientFactory), copy.HttpClientFactory.GetType());
Assert.Same(copy.HttpClientFactory, options.HttpClientFactory);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,19 @@ public async Task GetMessagingWithClientFactory()
{
var handler = new MockMessageHandler()
{
Response = new FirebaseMessagingClient.SendResponse()
Response = new FirebaseMessagingClient.SingleMessageResponse()
{
Name = "test-response",
},
};
var factory = new MockHttpClientFactory(handler);

var app = FirebaseApp.Create(new AppOptions() { Credential = GoogleCredential.FromAccessToken("test-token"), HttpClientFactory = factory, ProjectId = "test-project" });
var app = FirebaseApp.Create(new AppOptions()
{
Credential = GoogleCredential.FromAccessToken("test-token"),
HttpClientFactory = factory,
ProjectId = "test-project",
});
FirebaseMessaging messaging = FirebaseMessaging.GetMessaging(app);
Assert.NotNull(messaging);
Assert.Same(messaging, FirebaseMessaging.GetMessaging(app));
Expand Down Expand Up @@ -101,7 +106,11 @@ await Assert.ThrowsAsync<OperationCanceledException>(
[Fact]
public async Task SendMessageCancelWithClientFactory()
{
FirebaseApp.Create(new AppOptions() { Credential = MockCredential, HttpClientFactory = new HttpClientFactory() });
FirebaseApp.Create(new AppOptions()
{
Credential = MockCredential,
HttpClientFactory = new HttpClientFactory(),
});
var canceller = new CancellationTokenSource();
canceller.Cancel();
await Assert.ThrowsAsync<OperationCanceledException>(
Expand Down

0 comments on commit 5e5a7d3

Please sign in to comment.