-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#26 REST API - BankAccountController
- Loading branch information
1 parent
3634cc1
commit 67f18d9
Showing
4 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -23,3 +23,4 @@ | |
app.MapControllers(); | ||
|
||
app.Run(); | ||
public partial class Program { } |
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
51 changes: 49 additions & 2 deletions
51
test/Optivem.Kata.Banking.Test/System/BankAccountControllerSystemTest.cs
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,14 +1,61 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using Newtonsoft.Json; | ||
using Optivem.Kata.Banking.Test.Common.Builders.RequestBuilders; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Optivem.Kata.Banking.Test.System | ||
{ | ||
public class BankAccountControllerSystemTest | ||
public class BankAccountControllerSystemTest : IDisposable | ||
{ | ||
private readonly HttpClient _client; | ||
|
||
public BankAccountControllerSystemTest() | ||
{ | ||
var application = new WebApplicationFactory<Program>() | ||
.WithWebHostBuilder(builder => | ||
{ | ||
// TODO: VC: Configure | ||
}); | ||
|
||
_client = application.CreateClient(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_client.Dispose(); | ||
} | ||
|
||
|
||
[Fact] | ||
public async Task Nothing() | ||
{ | ||
var response = await _client.GetAsync("weather"); | ||
|
||
response.EnsureSuccessStatusCode(); | ||
|
||
} | ||
|
||
[Fact(Skip = "TODO: In progress")] | ||
public async Task Should_open_bank_account_given_valid_request() | ||
{ | ||
var url = "bank-accounts"; | ||
|
||
var request = OpenAccountRequestBuilder.OpenAccount() | ||
.Build(); | ||
|
||
var json = JsonConvert.SerializeObject(request); | ||
var body = new StringContent(json, Encoding.UTF8, "application/json"); | ||
|
||
var response = await _client.PostAsync(url, body); | ||
|
||
response.EnsureSuccessStatusCode(); | ||
} | ||
|
||
} | ||
} |