Skip to content

Commit

Permalink
Fixed build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Jan 4, 2024
1 parent 8abd9e1 commit d1269d7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Foundatio.TestHarness/Caching/CacheClientTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ public virtual async Task CanManageListsAsync() {
await cache.ListRemoveAsync("test1", new[] { 1, 2, 3 });
result = await cache.GetListAsync<int>("test1");
Assert.NotNull(result);
Assert.Equal(0, result.Value.Count);
Assert.Empty(result.Value);

// test single strings don't get handled as char arrays
await cache.RemoveAllAsync();
Expand Down Expand Up @@ -722,7 +722,7 @@ public virtual async Task CanManageListsAsync() {
await cache.ListRemoveAsync("test1", 3);
result = await cache.GetListAsync<int>("test1");
Assert.NotNull(result);
Assert.Equal(0, result.Value.Count);
Assert.Empty(result.Value);

await Assert.ThrowsAnyAsync<Exception>(async () => {
await cache.AddAsync("key1", 1);
Expand Down
6 changes: 3 additions & 3 deletions src/Foundatio.TestHarness/Messaging/MessageBusTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public virtual async Task WillOnlyReceiveSubscribedMessageTypeAsync() {
try {
var countdown = new AsyncCountdownEvent(1);
await messageBus.SubscribeAsync<SimpleMessageB>(msg => {
Assert.True(false, "Received wrong message type");
Assert.Fail("Received wrong message type");
});
await messageBus.SubscribeAsync<SimpleMessageA>(msg => {
Assert.Equal("Hello", msg.Data);
Expand Down Expand Up @@ -517,10 +517,10 @@ public virtual async Task CanCancelSubscriptionAsync() {

long messageCount = 0;
var cancellationTokenSource = new CancellationTokenSource();
await messageBus.SubscribeAsync<SimpleMessageA>(msg => {
await messageBus.SubscribeAsync<SimpleMessageA>(async msg => {
_logger.LogTrace("SimpleAMessage received");
Interlocked.Increment(ref messageCount);
cancellationTokenSource.Cancel();
await cancellationTokenSource.CancelAsync();
countdown.Signal();
}, cancellationTokenSource.Token);

Expand Down
14 changes: 7 additions & 7 deletions src/Foundatio.TestHarness/Storage/FileStorageTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public virtual async Task CanGetFileListForSingleFileAsync() {
await storage.SaveFileAsync(@"q\new.txt", "new");
await storage.SaveFileAsync(@"long/path/in/here/1.hey.stuff-2.json", "archived");

Assert.Equal(1, (await storage.GetFileListAsync(@"archived\archived.txt")).Count);
Assert.Single(await storage.GetFileListAsync(@"archived\archived.txt"));
}
}

Expand All @@ -85,26 +85,26 @@ public virtual async Task CanGetPagedFileListForSingleFolderAsync() {
using (storage) {
var result = await storage.GetPagedFileListAsync(1);
Assert.False(result.HasMore);
Assert.Equal(0, result.Files.Count);
Assert.Empty(result.Files);
Assert.False(await result.NextPageAsync());
Assert.False(result.HasMore);
Assert.Equal(0, result.Files.Count);
Assert.Empty(result.Files);

await storage.SaveFileAsync(@"archived\archived.txt", "archived");
result = await storage.GetPagedFileListAsync(1);
Assert.False(result.HasMore);
Assert.Equal(1, result.Files.Count);
Assert.Single(result.Files);
Assert.False(await result.NextPageAsync());
Assert.False(result.HasMore);
Assert.Equal(1, result.Files.Count);
Assert.Single(result.Files);

await storage.SaveFileAsync(@"q\new.txt", "new");
result = await storage.GetPagedFileListAsync(1);
Assert.True(result.HasMore);
Assert.Equal(1, result.Files.Count);
Assert.Single(result.Files);
Assert.True(await result.NextPageAsync());
Assert.False(result.HasMore);
Assert.Equal(1, result.Files.Count);
Assert.Single(result.Files);

await storage.SaveFileAsync(@"long/path/in/here/1.hey.stuff-2.json", "archived");

Expand Down
6 changes: 3 additions & 3 deletions tests/Foundatio.Tests/Jobs/WorkItemJobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ await messageBus.SubscribeAsync<WorkItemStatus>(status => {
var tasks = new List<Task> {
Task.Run(async () => {
await j1.RunUntilEmptyAsync(cancellationTokenSource.Token);
cancellationTokenSource.Cancel();
await cancellationTokenSource.CancelAsync();
}, cancellationTokenSource.Token),
Task.Run(async () => {
await j2.RunUntilEmptyAsync(cancellationTokenSource.Token);
cancellationTokenSource.Cancel();
await cancellationTokenSource.CancelAsync();
}, cancellationTokenSource.Token),
Task.Run(async () => {
await j3.RunUntilEmptyAsync(cancellationTokenSource.Token);
cancellationTokenSource.Cancel();
await cancellationTokenSource.CancelAsync();
}, cancellationTokenSource.Token)
};

Expand Down

0 comments on commit d1269d7

Please sign in to comment.