Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test #25

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10));

// Act
_clientStub.IsConnected = true;
await _sut.StartAsync(cancellationTokenSource.Token);
await _clientStub.CallConnectedAsync(new MqttClientConnectedEventArgs(new MqttClientConnectResult()));
await _clientStub.CallConnectionStateChangedAsync(new MqttClientConnectedEventArgs(new MqttClientConnectResult()));

// Assert
listener.RecordObservableInstruments();
Expand Down Expand Up @@ -87,7 +88,7 @@
var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10));

await _sut.StartAsync(cancellationTokenSource.Token);
await _clientStub.CallConnectedAsync(new MqttClientConnectedEventArgs(new MqttClientConnectResult()));
await _clientStub.CallConnectionStateChangedAsync(new MqttClientConnectedEventArgs(new MqttClientConnectResult()));

var message = new MqttApplicationMessageBuilder()
.WithTopic("my-topic")
Expand All @@ -106,7 +107,7 @@
{
public IMqttClient InternalClient => throw new NotImplementedException();

public bool IsConnected => throw new NotImplementedException();
public bool IsConnected { get; set; }

public bool IsStarted => throw new NotImplementedException();

Expand All @@ -114,9 +115,9 @@

public int PendingApplicationMessagesCount => throw new NotImplementedException();

public event Func<ApplicationMessageProcessedEventArgs, Task> ApplicationMessageProcessedAsync = null!;

Check warning on line 118 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageProcessedAsync' is assigned but its value is never used

Check warning on line 118 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageProcessedAsync' is assigned but its value is never used

Check warning on line 118 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageProcessedAsync' is assigned but its value is never used

Check warning on line 118 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageProcessedAsync' is assigned but its value is never used
public event Func<MqttApplicationMessageReceivedEventArgs, Task> ApplicationMessageReceivedAsync = null!;

Check warning on line 119 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageReceivedAsync' is assigned but its value is never used

Check warning on line 119 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageReceivedAsync' is assigned but its value is never used

Check warning on line 119 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageReceivedAsync' is assigned but its value is never used

Check warning on line 119 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageReceivedAsync' is assigned but its value is never used
public event Func<ApplicationMessageSkippedEventArgs, Task> ApplicationMessageSkippedAsync = null!;

Check warning on line 120 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageSkippedAsync' is assigned but its value is never used

Check warning on line 120 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageSkippedAsync' is assigned but its value is never used

Check warning on line 120 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageSkippedAsync' is assigned but its value is never used

Check warning on line 120 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ApplicationMessageSkippedAsync' is assigned but its value is never used
public event Func<MqttClientConnectedEventArgs, Task> ConnectedAsync = null!;

public Task CallConnectedAsync(MqttClientConnectedEventArgs args)
Expand All @@ -124,14 +125,18 @@
return ConnectedAsync.Invoke(args);
}

public event Func<ConnectingFailedEventArgs, Task> ConnectingFailedAsync = null!;

Check warning on line 128 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ConnectingFailedAsync' is assigned but its value is never used

Check warning on line 128 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ConnectingFailedAsync' is assigned but its value is never used

Check warning on line 128 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ConnectingFailedAsync' is assigned but its value is never used

Check warning on line 128 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.ConnectingFailedAsync' is assigned but its value is never used
public event Func<EventArgs, Task> ConnectionStateChangedAsync = null!;
public Task CallConnectionStateChangedAsync(EventArgs args)
{
return ConnectionStateChangedAsync.Invoke(args);
}
public event Func<MqttClientDisconnectedEventArgs, Task> DisconnectedAsync = null!;
public Task CallDisconnectedAsync(MqttClientDisconnectedEventArgs args)
{
return DisconnectedAsync.Invoke(args);
}
public event Func<ManagedProcessFailedEventArgs, Task> SynchronizingSubscriptionsFailedAsync = null!;

Check warning on line 139 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.SynchronizingSubscriptionsFailedAsync' is assigned but its value is never used

Check warning on line 139 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.SynchronizingSubscriptionsFailedAsync' is assigned but its value is never used

Check warning on line 139 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.SynchronizingSubscriptionsFailedAsync' is assigned but its value is never used

Check warning on line 139 in test/ToMqttNet.Test.Unit/MqttConnectionServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

The field 'MqttClientStub.SynchronizingSubscriptionsFailedAsync' is assigned but its value is never used

public List<MqttApplicationMessage> EnqueuedMessage = new List<MqttApplicationMessage>();
public List<MqttTopicFilter> Subscriptions = new List<MqttTopicFilter>();
Expand Down