Skip to content

Commit

Permalink
Fixed new warnings introduced in new version of roslyn
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed May 2, 2024
1 parent bd5b0ef commit 8ede66e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed class AppScopedHaContextProviderTest : IDisposable
};

[Fact]
public async void TestCallService()
public async Task TestCallService()
{
var haContext = await CreateTargetAsync();

Expand All @@ -48,7 +48,7 @@ public async void TestCallService()
}

[Fact]
public async void TestCallServiceWithFloor()
public async Task TestCallServiceWithFloor()
{
var haContext = await CreateTargetAsync();

Expand All @@ -72,7 +72,7 @@ public async void TestCallServiceWithFloor()
}

[Fact]
public async void TestCallServiceWithLabel()
public async Task TestCallServiceWithLabel()
{
var haContext = await CreateTargetAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace NetDaemon.HassModel.Tests.Internal;
public class EntityStateCacheTest
{
[Fact]
public async void StateChangeEventIsFirstStoredInCacheThanForwarded()
public async Task StateChangeEventIsFirstStoredInCacheThanForwarded()
{
var entityId = "sensor.test";

Expand All @@ -36,7 +36,7 @@ public async void StateChangeEventIsFirstStoredInCacheThanForwarded()
n.SubscribeToHomeAssistantEventsAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(testSubject
);

var serviceColletion = new ServiceCollection();
_ = serviceColletion.AddTransient<IObservable<HassEvent>>(_ => testSubject);
var sp = serviceColletion.BuildServiceProvider();
Expand Down Expand Up @@ -83,7 +83,7 @@ public async void StateChangeEventIsFirstStoredInCacheThanForwarded()
}

[Fact]
public async void AllEntityIds_returnsInitialPlusChangedEntities()
public async Task AllEntityIds_returnsInitialPlusChangedEntities()
{
// Arrange
using var testSubject = new Subject<HassEvent>();
Expand All @@ -103,12 +103,12 @@ public async void AllEntityIds_returnsInitialPlusChangedEntities()
});

var serviceColletion = new ServiceCollection();

_hassConnectionMock.Setup(n =>
n.SubscribeToHomeAssistantEventsAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(testSubject
);

var sp = serviceColletion.BuildServiceProvider();

using var cache = new EntityStateCache(haRunnerMock.Object, sp);
Expand Down Expand Up @@ -140,4 +140,4 @@ public async void AllEntityIds_returnsInitialPlusChangedEntities()
// Assert
cache.AllEntityIds.Should().BeEquivalentTo("sensor.sensor1", "sensor.sensor2");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NetDaemon.HassModel.Tests.Internal;
public class QueuedObservabeTest
{
[Fact]
public async void EventsSouldbeforwarded()
public async Task EventsSouldbeforwarded()
{
var source = new Subject<int>();

Expand All @@ -28,7 +28,7 @@ public async void EventsSouldbeforwarded()
}

[Fact]
public async void SubscribersShouldNotBlockEachOther()
public async Task SubscribersShouldNotBlockEachOther()
{
var source = new Subject<int>();

Expand Down Expand Up @@ -90,11 +90,11 @@ public async Task WhenScopeIsDisposedSubscribersAreDetached()
await Task.WhenAll(waitTasks);

await scoped1.DisposeAsync();

var waitTask2 = scope2ObserverMock.WaitForInvocationAndVerify(o => o.OnNext("Event2"));
testSubject.OnNext("Event2");
await waitTask2;

scope1AObserverMock.Verify(o => o.OnNext("Event2"), Times.Never, "Event should not reach Observer of disposed scope");
scope1BObserverMock.Verify(o => o.OnNext("Event2"), Times.Never, "Event should not reach Observer of disposed scope");
scope2ObserverMock.Verify(o => o.OnNext("Event2"), Times.Once);
Expand All @@ -115,7 +115,7 @@ public async Task TestQueuedObservableShouldHaveFinishedTasksOnDispose()
queue.Subscribe(subscriber.Object);

// It is not enough that DisposeAsync waits on task
// since it can be aborted by the cancellation token
// since it can be aborted by the cancellation token
var waitOnCallTask = subscriber.WaitForInvocation(n => n.OnNext(1));
source.OnNext(1);
await waitOnCallTask;
Expand Down

0 comments on commit 8ede66e

Please sign in to comment.