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

chore: Remove IBugsnagger::*Async #76

Merged
merged 1 commit into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions Bugsnag.NET.Tests/Bugsnag.NET.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@
<Compile Include="ExceptionExtensionTests.cs" />
<Compile Include="Integration\IntegrationTests.PCL.cs" />
<Compile Include="Integration\Utils\InstanceApproachApp.cs" />
<Compile Include="Integration\Utils\InstanceApproachAsyncApp.cs" />
<Compile Include="Integration\Utils\ITestApp.cs" />
<Compile Include="Integration\Utils\StaticApproachApp.cs" />
<Compile Include="Integration\Utils\StaticApproachAsyncApp.cs" />
<Compile Include="Integration\Utils\Utils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Integration\IntegrationTests.NET.cs" />
Expand Down
42 changes: 0 additions & 42 deletions Bugsnag.NET.Tests/Integration/IntegrationTests.NET.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ public void SendError_StaticApproach()
Utils.Run(StaticApproach.TestApp);
}

[Test]
public async Task SendError_StaticApproachAsync()
{
await Utils.Run(StaticApproach.AsyncTestApp);
}

[Test]
public void SendError_InstanceApproach()
{
Expand All @@ -34,14 +28,6 @@ public void SendError_InstanceApproach()
);
}

[Test]
public async Task SendError_InstanceApproachAsync()
{
await Utils.Run(
_instanceApproach.AsyncTestApp(snagger => snagger.ErrorAsync)
);
}

[Test]
public void SendWarning_InstanceApproach()
{
Expand All @@ -50,14 +36,6 @@ public void SendWarning_InstanceApproach()
);
}

[Test]
public async Task SendWarning_InstanceApproachAsync()
{
await Utils.Run(
_instanceApproach.AsyncTestApp(snagger => snagger.WarningAsync)
);
}

[Test]
public void SendInfo_InstanceApproach()
{
Expand All @@ -66,14 +44,6 @@ public void SendInfo_InstanceApproach()
);
}

[Test]
public async Task SendInfo_InstanceApproachAsync()
{
await Utils.Run(
_instanceApproach.AsyncTestApp(snagger => snagger.InfoAsync)
);
}

static InstanceApproach _instanceApproach = new InstanceApproach(_GetSnagger);

static IBugsnagger _GetSnagger() => new BsNET.Bugsnagger
Expand All @@ -93,11 +63,6 @@ class StaticApproach
_SetApp,
_OnUnhandledException
);
public static IAsyncTestApp AsyncTestApp { get; } = new StaticApproachAsyncApp(
_SetApiKey,
_SetApp,
_OnUnhandledExceptionAsync
);

static void _SetApiKey(string key) => BsNET.Bugsnag.ApiKey = key;
static void _SetApp() => BsNET.Bugsnag.App = new App
Expand All @@ -112,13 +77,6 @@ static void _OnUnhandledException(Exception ex)

client.Notify(@event);
}
static Task _OnUnhandledExceptionAsync(Exception ex)
{
var client = BsNET.Bugsnag.Error;
var @event = client.GetEvent(ex, null, _GetMetadata());

return client.NotifyAsync(@event);
}

static object _GetMetadata() =>
new
Expand Down
42 changes: 0 additions & 42 deletions Bugsnag.NET.Tests/Integration/IntegrationTests.PCL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ public void SendError_StaticApproach()
Utils.Run(StaticApproach.TestApp);
}

[Test]
public async Task SendError_StaticApproachAsync()
{
await Utils.Run(StaticApproach.AsyncTestApp);
}

[Test]
public void SendError_InstanceApproach()
{
Expand All @@ -33,14 +27,6 @@ public void SendError_InstanceApproach()
);
}

[Test]
public async Task SendError_InstanceApproachAsync()
{
await Utils.Run(
_instanceApproach.AsyncTestApp(snagger => snagger.ErrorAsync)
);
}

[Test]
public void SendWarning_InstanceApproach()
{
Expand All @@ -49,14 +35,6 @@ public void SendWarning_InstanceApproach()
);
}

[Test]
public async Task SendWarning_InstanceApproachAsync()
{
await Utils.Run(
_instanceApproach.AsyncTestApp(snagger => snagger.WarningAsync)
);
}

[Test]
public void SendInfo_InstanceApproach()
{
Expand All @@ -65,14 +43,6 @@ public void SendInfo_InstanceApproach()
);
}

[Test]
public async Task SendInfo_InstanceApproachAsync()
{
await Utils.Run(
_instanceApproach.AsyncTestApp(snagger => snagger.InfoAsync)
);
}

static InstanceApproach _instanceApproach = new InstanceApproach(_GetSnagger);

static IBugsnagger _GetSnagger() => new BsPCL.Bugsnagger
Expand All @@ -92,11 +62,6 @@ class StaticApproach
_SetApp,
_OnUnhandledException
);
public static IAsyncTestApp AsyncTestApp { get; } = new StaticApproachAsyncApp(
_SetApiKey,
_SetApp,
_OnUnhandledExceptionAsync
);

static void _SetApiKey(string key) => BsPCL.Bugsnag.ApiKey = key;
static void _SetApp() => BsPCL.Bugsnag.App = new App
Expand All @@ -111,13 +76,6 @@ static void _OnUnhandledException(Exception ex)

client.Notify(@event);
}
static Task _OnUnhandledExceptionAsync(Exception ex)
{
var client = BsPCL.Bugsnag.Error;
var @event = client.GetEvent(ex, null, _GetMetadata());

return client.NotifyAsync(@event);
}

static object _GetMetadata() =>
new
Expand Down
5 changes: 0 additions & 5 deletions Bugsnag.NET.Tests/Integration/Utils/ITestApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ interface ITestApp
{
void Run(string testInfo);
}

interface IAsyncTestApp
{
Task Run(string testInfo);
}
}
40 changes: 0 additions & 40 deletions Bugsnag.NET.Tests/Integration/Utils/InstanceApproachAsyncApp.cs

This file was deleted.

45 changes: 0 additions & 45 deletions Bugsnag.NET.Tests/Integration/Utils/StaticApproachAsyncApp.cs

This file was deleted.

24 changes: 0 additions & 24 deletions Bugsnag.NET.Tests/Integration/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@ internal static void Run(
Inconclusive();
}

internal static async Task Run(
IAsyncTestApp app,
[CallerMemberName] string callerName = "[unknown test]",
[CallerFilePath] string sourceFilePath = "[unknown file]",
[CallerLineNumber] int sourceLineNumber = 0)
{
var fileHint = $"{sourceFilePath}:{sourceLineNumber}";

await app.Run($"{callerName} ({sourceFilePath}:{sourceLineNumber})");

Inconclusive();
}


public static void TriggerError(string testInfo)
{
throw new ApplicationException($"Error triggered by {testInfo}");
Expand Down Expand Up @@ -84,16 +70,6 @@ public ITestApp TestApp(Func<IBugsnagger, Action<Exception, IUser, object>> getN
return TestApp((snagger, ex) => getNotify(snagger)(ex, null, _GetMetadata()));
}

public IAsyncTestApp AsyncTestApp(Func<IBugsnagger, Exception, Task> notifyAsync)
{
return new InstanceApproachAsyncApp(_getSnagger(), notifyAsync);
}

public IAsyncTestApp AsyncTestApp(Func<IBugsnagger, Func<Exception, IUser, object, Task>> getNotify)
{
return AsyncTestApp((snagger, ex) => getNotify(snagger)(ex, null, _GetMetadata()));
}

object _GetMetadata() =>
new
{
Expand Down
5 changes: 0 additions & 5 deletions Bugsnag.NET/Bugsnag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ private Bugsnag(Severity severity)
public void Notify(IEnumerable<IEvent> events) => Snagger.Notify(events);
public void Notify(IEnumerable<IEvent> events, bool useSSL) => Snagger.Notify(events, useSSL);

public Task<HttpResponseMessage> NotifyAsync(IEvent evt) => Snagger.NotifyAsync(evt);
public Task<HttpResponseMessage> NotifyAsync(IEvent evt, bool useSSL) => Snagger.NotifyAsync(evt, useSSL);
public Task<HttpResponseMessage> NotifyAsync(IEnumerable<IEvent> events) => Snagger.NotifyAsync(events);
public Task<HttpResponseMessage> NotifyAsync(IEnumerable<IEvent> events, bool useSSL) => Snagger.NotifyAsync(events, useSSL);

public IEvent GetEvent(Exception ex, IUser user, object metaData)
{
return new Event(ex, Snagger.FinalizeStacktraceLine)
Expand Down
Loading