feat: setup initial create payment endpoint
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
namespace GroundsForSupport.Server.Tests;
|
||||
|
||||
public class ExampleTests
|
||||
{
|
||||
[Fact]
|
||||
public void SampleTest()
|
||||
{
|
||||
Assert.True(true);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
<Using Include="AwesomeAssertions" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -26,6 +27,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageReference Include="xunit.v3" Version="3.2.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
|
||||
namespace GroundsForSupport.API.Tests.Integration.Infra;
|
||||
|
||||
public sealed class TestApi : WebApplicationFactory<Program>
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using GroundsForSupport.API.Tests.Integration.Infra;
|
||||
|
||||
namespace GroundsForSupport.API.Tests.Integration;
|
||||
|
||||
public sealed class PaymentTests(TestApi api) : IClassFixture<TestApi>
|
||||
{
|
||||
private readonly TestApi _api = api;
|
||||
|
||||
[Fact]
|
||||
public async Task CreatePaymentIntent_WhenGivenInvalidAmount_ItShouldReturnBadRequest()
|
||||
{
|
||||
var client = _api.CreateClient();
|
||||
|
||||
var request = new {
|
||||
amount = 0,
|
||||
email = string.Empty,
|
||||
};
|
||||
|
||||
var response = await client.PostAsJsonAsync("/create-payment-intent", request, TestContext.Current.CancellationToken);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user