mirror of
https://github.com/farcasclaudiu/PracticeCalendar.git
synced 2026-06-22 09:01:18 +03:00
nice refactorings
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using FluentAssertions;
|
||||
using PracticeCalendar.Application.PracticeEvents.Commands;
|
||||
using PracticeCalendar.Application.PracticeEvents.Queries;
|
||||
|
||||
using static PracticeCalendar.UnitTests.Integration.Testing;
|
||||
|
||||
namespace PracticeCalendar.UnitTests.Integration.PracticeEvents
|
||||
{
|
||||
public class CreatePracticeEventsTest : BaseTest
|
||||
{
|
||||
[Fact]
|
||||
public async Task ShouldCreatePracticeEvent()
|
||||
{
|
||||
await RunBeforeAnyTests();
|
||||
|
||||
var query = new CreatePracticeEventCommand(new PracticeEventDto
|
||||
{
|
||||
Title = "Some title",
|
||||
Description = "Some desc",
|
||||
StartTime = DateTime.Now,
|
||||
EndTime = DateTime.Now,
|
||||
Attendees = {
|
||||
new AttendeeDto
|
||||
{
|
||||
Name = "Claudiu F",
|
||||
EmailAddress = "claudiuf@somewhere.com"
|
||||
},
|
||||
new AttendeeDto
|
||||
{
|
||||
Name = "Claudiu F 2",
|
||||
EmailAddress = "claudiuf2@somewhere.com"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var result = await SendAsync(query);
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().NotBe(0);
|
||||
result.Attendees.Count.Should().Be(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using FluentAssertions;
|
||||
using PracticeCalendar.Application.PracticeEvents.Queries.GetPracticeEvents;
|
||||
using PracticeCalendar.Domain.Entities;
|
||||
|
||||
using static PracticeCalendar.UnitTests.Integration.Testing;
|
||||
|
||||
namespace PracticeCalendar.UnitTests.Integration.PracticeEvents
|
||||
{
|
||||
public class GetPracticeEventsTest : BaseTest
|
||||
{
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldReturnZeroResult()
|
||||
{
|
||||
await RunBeforeAnyTests();
|
||||
|
||||
var query = new GetPracticeEventsQuery();
|
||||
|
||||
var result = await SendAsync(query);
|
||||
|
||||
result.Count.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ShouldReturnAllListsAndItems()
|
||||
{
|
||||
await RunBeforeAnyTests();
|
||||
|
||||
await AddAsync(new PracticeEvent("Test Event", "Event description")
|
||||
{
|
||||
Id = 1,
|
||||
Attendees = {
|
||||
new Attendee("Claudiu F", "claudiuf@busybee.com")
|
||||
{
|
||||
Id = 1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var query = new GetPracticeEventsQuery();
|
||||
|
||||
var result = await SendAsync(query);
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Attendees.Should().HaveCount(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user