-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Libs(CSharp): add kitchen sink test"
This reverts commit 1f05d0e. The test new runs fine on dotnet 8.0, but CI complains about something in the source using language features too new. The project currently targets dotnet 5.0, which seems to be EOL, so we should look at updating the target first, after we can un-revert this test. For now, just know the test passed for me with a tweak to the Svix.Test solution so it can run on 8.0. This gives me some confidence that the generator bump produced some okay code.
- Loading branch information
1 parent
1f05d0e
commit ba22cf1
Showing
2 changed files
with
13 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Svix.Client; | ||
using Svix.Model; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Svix.Models; | ||
using Xunit; | ||
|
||
namespace Svix.Tests; | ||
|
||
public class SvixClientTests | ||
namespace Svix.Tests | ||
{ | ||
[Fact] | ||
public void Constructor_WhenCalled_DoesNotNeedLogger() | ||
{ | ||
var sut = new SvixClient("", new SvixOptions("http://some.url")); | ||
|
||
Assert.NotNull(sut); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_WhenCalled_AcceptsLogger() | ||
public class SvixClientTests | ||
{ | ||
var sut = new SvixClient("", new SvixOptions("http://some.url"), new NullLogger<SvixClient>()); | ||
|
||
Assert.NotNull(sut); | ||
} | ||
|
||
[IgnoreIfClientVarsUnset] | ||
public void KitchenSink_SeemsToWorkOkay() | ||
{ | ||
var token = Environment.GetEnvironmentVariable("SVIX_TOKEN"); | ||
var url = Environment.GetEnvironmentVariable("SVIX_SERVER_URL"); | ||
var client = new SvixClient(token, new SvixOptions(url)); | ||
|
||
var app = client.Application.Create(new ApplicationIn(name: "App")); | ||
try | ||
[Fact] | ||
public void Constructor_WhenCalled_DoesNotNeedLogger() | ||
{ | ||
client.EventType.Create(new EventTypeIn(name: "event.started", description: "Something started")); | ||
} | ||
catch (ApiException e) | ||
{ | ||
// We expect conflicts, but any other status is an error | ||
Assert.Equal(409, e.ErrorCode); | ||
} | ||
var sut = new SvixClient("", new SvixOptions("http://some.url")); | ||
|
||
try | ||
{ | ||
client.EventType.Create(new EventTypeIn(name: "event.ended", description: "Something ended")); | ||
} | ||
catch (ApiException e) | ||
{ | ||
// We expect conflicts, but any other status is an error | ||
Assert.Equal(409, e.ErrorCode); | ||
Assert.NotNull(sut); | ||
} | ||
|
||
var ep = client.Endpoint.Create(app.Id, | ||
new EndpointIn(url: "https://example.svix.com/", channels: new List<string> { "ch0", "ch1" })); | ||
|
||
ep.Channels.Sort(); | ||
Assert.Equal(new List<string> { "ch0", "ch1" }, ep.Channels); | ||
Assert.Null(ep.FilterTypes); | ||
|
||
var epPatched = client.Endpoint.Patch(app.Id, ep.Id, | ||
new EndpointPatch(filterTypes: new List<string> { "event.started", "event.ended" })); | ||
epPatched.Channels.Sort(); | ||
epPatched.FilterTypes.Sort(); | ||
Assert.Equal(new List<string> { "ch0", "ch1" }, epPatched.Channels); | ||
Assert.Equal(new List<string> { "event.ended", "event.started" }, epPatched.FilterTypes); | ||
[Fact] | ||
public void Constructor_WhenCalled_AcceptsLogger() | ||
{ | ||
var sut = new SvixClient("", new SvixOptions("http://some.url"), new NullLogger<SvixClient>()); | ||
|
||
// Should not throw an exception if the serialization code handles empty bodies properly | ||
client.Endpoint.Delete(app.Id, ep.Id); | ||
Assert.NotNull(sut); | ||
} | ||
} | ||
} |