35 lines
1009 B
C#
35 lines
1009 B
C#
using Knot.IntegrationTests;
|
|
using FluentAssertions;
|
|
using Knot.Modules.Stories.Application.Stories.Commands.CreateStory;
|
|
using Knot.Shared.Kernel;
|
|
using Microsoft.AspNetCore.TestHost;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using NSubstitute;
|
|
using System.Net;
|
|
using System.Net.Http.Json;
|
|
using Xunit;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Knot.IntegrationTests.Stories;
|
|
|
|
public class StoriesTests : BaseIntegrationTest
|
|
{
|
|
[Fact]
|
|
public async Task CreateStory_ShouldReturnOk_WhenValidRequest()
|
|
{
|
|
// Arrange
|
|
var request = new CreateStoryRequest("Text", null, "Hello Integration Test", null);
|
|
|
|
// Act
|
|
var response = await _client.PostAsJsonAsync("api/stories", request);
|
|
|
|
// Assert
|
|
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
|
|
|
var content = await response.Content.ReadFromJsonAsync<dynamic>();
|
|
}
|
|
}
|
|
|
|
public record CreateStoryRequest(string Type, string? MediaUrl, string? Content, string? BgColor);
|