Skip to content

Commit

Permalink
Separates tests out a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
joncloud committed Aug 6, 2020
1 parent 823c9c5 commit 56b1cf4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Xunit;

namespace Https.Tests
{
public class IntegrationTests : IClassFixture<WebHostFixture>
public class ContentTypeTests : IClassFixture<WebHostFixture>
{
readonly WebHostFixture _fixture;
public IntegrationTests(WebHostFixture fixture) =>
public ContentTypeTests(WebHostFixture fixture) =>
_fixture = fixture;

[Fact]
Expand Down Expand Up @@ -64,19 +62,5 @@ public async Task MirrorTest_ShouldReflectXml()

Assert.Equal(expected, actual);
}

[Fact]
public async Task RedirectTest_ShouldShow3XXResponse_GivenStopAutoRedirects()
{
var args = new[]
{
"get", "http://localhost:5000/Redirect", "--stop-auto-redirects"
};

var result = await Https.ExecuteAsync(args);

Assert.Equal("HTTP/1.1 301 Moved Permanently", result.Status);
Assert.Equal("http://localhost:5000/Mirror", result.Headers["Location"]);
}
}
}
26 changes: 26 additions & 0 deletions tests/https.Tests/RedirectTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Threading.Tasks;
using Xunit;

namespace Https.Tests
{
public class RedirectTests : IClassFixture<WebHostFixture>
{
readonly WebHostFixture _fixture;
public RedirectTests(WebHostFixture fixture) =>
_fixture = fixture;

[Fact]
public async Task RedirectTest_ShouldShow3XXResponse_GivenStopAutoRedirects()
{
var args = new[]
{
"get", $"{_fixture.HttpUrl}/Redirect", "--stop-auto-redirects"
};

var result = await Https.ExecuteAsync(args);

Assert.Equal("HTTP/1.1 301 Moved Permanently", result.Status);
Assert.Equal($"{_fixture.HttpUrl}/Mirror", result.Headers["Location"]);
}
}
}

0 comments on commit 56b1cf4

Please sign in to comment.