Skip to content

Commit d442127

Browse files
committed
Remove redundant tests and fix comments
1 parent 3a40135 commit d442127

File tree

2 files changed

+9
-45
lines changed

2 files changed

+9
-45
lines changed

FirebaseAdmin/FirebaseAdmin.Tests/Auth/FirebaseUserManagerTest.cs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public async Task GetUserById()
8686
ProjectId = MockProjectId,
8787
ClientFactory = factory,
8888
});
89-
UserRecord userRecord = await userManager.GetUserById("user1");
89+
var userRecord = await userManager.GetUserById("user1");
9090
Assert.Equal("user1", userRecord.Uid);
9191
}
9292

@@ -109,25 +109,6 @@ await Assert.ThrowsAsync<FirebaseException>(
109109
async () => await userManager.GetUserById("user1"));
110110
}
111111

112-
[Fact]
113-
public async Task GetUserByIdInvalidToken()
114-
{
115-
var handler = new MockMessageHandler()
116-
{
117-
StatusCode = HttpStatusCode.Unauthorized,
118-
};
119-
var factory = new MockHttpClientFactory(handler);
120-
var userManager = new FirebaseUserManager(
121-
new FirebaseUserManagerArgs
122-
{
123-
Credential = MockCredential,
124-
ProjectId = MockProjectId,
125-
ClientFactory = factory,
126-
});
127-
await Assert.ThrowsAsync<FirebaseException>(
128-
async () => await userManager.GetUserById("user1"));
129-
}
130-
131112
[Fact]
132113
public async Task UpdateUser()
133114
{
@@ -262,24 +243,5 @@ public async Task DeleteUserNotFound()
262243
await Assert.ThrowsAsync<FirebaseException>(
263244
async () => await userManager.DeleteUser("user1"));
264245
}
265-
266-
[Fact]
267-
public async Task DeleteUserInvalidToken()
268-
{
269-
var handler = new MockMessageHandler()
270-
{
271-
StatusCode = HttpStatusCode.Unauthorized,
272-
};
273-
var factory = new MockHttpClientFactory(handler);
274-
var userManager = new FirebaseUserManager(
275-
new FirebaseUserManagerArgs
276-
{
277-
Credential = MockCredential,
278-
ProjectId = MockProjectId,
279-
ClientFactory = factory,
280-
});
281-
await Assert.ThrowsAsync<FirebaseException>(
282-
async () => await userManager.DeleteUser("user1"));
283-
}
284246
}
285247
}

FirebaseAdmin/FirebaseAdmin/Auth/FirebaseUserManager.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ public static FirebaseUserManager Create(FirebaseApp app)
6565
/// Gets the user data corresponding to the given user ID.
6666
/// </summary>
6767
/// <param name="uid">A user ID string.</param>
68-
/// <param name="cancellationToken">For asynchronous operation.</param>
68+
/// <param name="cancellationToken">A cancellation token to monitor the asynchronous
69+
/// operation.</param>
6970
/// <returns>A record of user with the queried id if one exists.</returns>
7071
public async Task<UserRecord> GetUserById(
7172
string uid, CancellationToken cancellationToken = default(CancellationToken))
7273
{
7374
if (string.IsNullOrEmpty(uid))
7475
{
75-
throw new ArgumentException("Failed to get user. User id cannot be null or empty");
76+
throw new ArgumentException("User ID cannot be null or empty.");
7677
}
7778

7879
const string getUserPath = "accounts:lookup";
@@ -110,16 +111,17 @@ public async Task UpdateUserAsync(
110111
}
111112

112113
/// <summary>
113-
/// Delete user with a given id.
114+
/// Delete user data corresponding to the given user ID.
114115
/// </summary>
115-
/// <param name="uid">The delete query user id.</param>
116-
/// <param name="cancellationToken">For asynchronous operation.</param>
116+
/// <param name="uid">A user ID string.</param>
117+
/// <param name="cancellationToken">A cancellation token to monitor the asynchronous
118+
/// operation.</param>
117119
public async Task DeleteUser(
118120
string uid, CancellationToken cancellationToken = default(CancellationToken))
119121
{
120122
if (string.IsNullOrEmpty(uid))
121123
{
122-
throw new ArgumentException("Failed to delete user. User id cannot be null or empty");
124+
throw new ArgumentException("User id cannot be null or empty.");
123125
}
124126

125127
const string getUserPath = "accounts:delete";

0 commit comments

Comments
 (0)