Skip to content

Commit

Permalink
tests further adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangroese committed Jun 19, 2023
1 parent efc333f commit 6ea5d0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
14 changes: 11 additions & 3 deletions Tests/Orso.Arpa.Api.Tests/IntegrationTests/NewsControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ public class NewsControllerTests : IntegrationTestBase
{
[Test, Order(1)]
public async Task Should_Get_All()

{
// Arrange
List<NewsDto> expectedDtos = new List<NewsDto> { NewsDtoData.SecondNews };

// Act
HttpResponseMessage responseMessage = await _authenticatedServer
.CreateClient()
Expand All @@ -31,14 +35,14 @@ public async Task Should_Get_All()
// Assert
_ = responseMessage.StatusCode.Should().Be(HttpStatusCode.OK);
IEnumerable<NewsDto> result = await DeserializeResponseMessageAsync<IEnumerable<NewsDto>>(responseMessage);
_ = result.Should().BeEquivalentTo(NewsDtoData.News, opt => opt.WithStrictOrdering());
_ = result.Should().BeEquivalentTo(expectedDtos, opt => opt.WithStrictOrdering());
}

[Test, Order(2)]
public async Task Should_Get_ById()
{
// Arrange
NewsDto expectedDto = NewsDtoData.Performer;
NewsDto expectedDto = NewsDtoData.SecondNews;

// Act
HttpResponseMessage responseMessage = await _authenticatedServer
Expand All @@ -60,7 +64,7 @@ public async Task Should_Modify()
{
NewsText = "ErsteNewsModifiziert",
Url = "http://orsopolis.com",
Show = false,
Show = false
};

var expectedDto = new NewsDto
Expand All @@ -69,6 +73,10 @@ public async Task Should_Modify()
NewsText = "ErsteNewsModifiziert",
Url = "http://orsopolis.com",
Show = false,
CreatedBy = "anonymous",
CreatedAt = FakeDateTime.UtcNow,
ModifiedAt = FakeDateTime.UtcNow,
ModifiedBy = "Staff Member"
};

// Act
Expand Down
10 changes: 4 additions & 6 deletions Tests/Orso.Arpa.Tests.Shared/DtoTestData/NewsDtoData.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using Orso.Arpa.Application.NewsApplication;
using Orso.Arpa.Domain.Entities;
using Orso.Arpa.Domain.Enums;
using Orso.Arpa.Tests.Shared.FakeData;

namespace Orso.Arpa.Tests.Shared.DtoTestData
Expand All @@ -15,13 +13,13 @@ public static IList<NewsDto> News
{
return new List<NewsDto>
{
Performer,
Staff
FirstNews,
SecondNews
};
}
}

public static NewsDto Staff
public static NewsDto FirstNews
{
get
{
Expand All @@ -37,7 +35,7 @@ public static NewsDto Staff
}
}

public static NewsDto Performer
public static NewsDto SecondNews
{
get
{
Expand Down

0 comments on commit 6ea5d0b

Please sign in to comment.