This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
36 additions
and
15 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
23 changes: 16 additions & 7 deletions
23
backend/Idontknow.IntegrationTests/Feature/Blogging/when_blog_is_added.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,23 +1,32 @@ | ||
using System.Net.Http; | ||
using Microsoft.AspNetCore.TestHost; | ||
using System.Linq; | ||
using Idontknow.Domain.ViewModels.Result; | ||
using Idontknow.Domain.ViewModels.Service.Blog; | ||
using Idontknow.IntegrationTests.Utils; | ||
using Xunit; | ||
|
||
namespace Idontknow.IntegrationTests.Feature.Blogging | ||
{ | ||
public class when_blog_is_added | ||
{ | ||
private TestServer _server; | ||
private HttpClient _client; | ||
|
||
private readonly int _newBlogId; | ||
private const string RequestUri = "/api/blogs"; | ||
public when_blog_is_added() | ||
{ | ||
// TODO: post | ||
_newBlogId = ApiClientFixture.Current.HttpPostJson<ServiceResult<int>>(RequestUri, new AddBlogRequestViewModel | ||
{ | ||
Rating = 4, | ||
Url = "www.test.com" | ||
}).Result.Payload; | ||
} | ||
|
||
[Fact] | ||
public void then_blog_should_be_in_database() | ||
{ | ||
// TODO: get | ||
ApiServerFixture.Current.DoDatabaseOperation(context => | ||
{ | ||
Assert.True(context.Blogs.SingleOrDefault(blog => blog.BlogId == _newBlogId) != null); | ||
}); | ||
} | ||
} | ||
} |
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
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