Skip to content

Commit bca5e8a

Browse files
Improve the caching transport tests (#4360)
The caching transport tests can fail when running the device tests if the simulator looses network connectivity. This PR changes the test to use a `FakeReliableNetworkStatusListener ` implementation of `INetworkStatusListener` that ignores the real network status and just pretends that everything is OK, so that test reliability isn't impacted by network connectivity. Extracted from #4294 #skip-changelog
1 parent 7bdb4b5 commit bca5e8a

File tree

2 files changed

+84
-213
lines changed

2 files changed

+84
-213
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Sentry.Testing;
2+
3+
/// <summary>
4+
/// To be used when we don't want the real network status to affect the reliability of our tests
5+
/// </summary>
6+
public class FakeReliableNetworkStatusListener : INetworkStatusListener
7+
{
8+
public static readonly FakeReliableNetworkStatusListener Instance = new();
9+
10+
private FakeReliableNetworkStatusListener()
11+
{
12+
}
13+
14+
public bool Online => true;
15+
16+
public Task WaitForNetworkOnlineAsync(CancellationToken cancellationToken)
17+
{
18+
return Task.CompletedTask;
19+
}
20+
}

0 commit comments

Comments
 (0)