nice refactorings

This commit is contained in:
2022-10-10 03:17:14 +03:00
parent 4ca234aec8
commit 28a6981001
30 changed files with 622 additions and 141 deletions
@@ -0,0 +1,59 @@
using FluentAssertions;
using PracticeCalendar.Domain.Entities;
namespace PracticeCalendar.UnitTests.Domain
{
public class PracticeEventTest
{
readonly string _eventTitle = "Event1";
readonly string _eventDescription = "Description";
readonly string _attendeeName = "Claudiu Farcas";
readonly string _atendeeEmail = "claudiu.farcas@testingbee.com";
[Fact]
public void InitializeProperties()
{
var practiceEvent = new PracticeEvent(_eventTitle, _eventDescription);
practiceEvent.Title.Should().Be(_eventTitle);
practiceEvent.Description.Should().Be(_eventDescription);
practiceEvent.Attendees.Should().HaveCount(0);
}
[Fact]
public void InitializeWithNullShouldThrowException()
{
Action act = () =>
{
var practiceEvent = new PracticeEvent(null!, _eventDescription);
};
act.Should().Throw<ArgumentNullException>();
act = () =>
{
var practiceEvent = new PracticeEvent(_eventTitle, null!);
};
act.Should().Throw<ArgumentNullException>();
act = () =>
{
var practiceEvent = new PracticeEvent(string.Empty, _eventDescription);
};
act.Should().Throw<ArgumentException>();
act = () =>
{
var practiceEvent = new PracticeEvent(_eventTitle, string.Empty);
};
act.Should().Throw<ArgumentException>();
}
[Fact]
public void AddAttendeeToEvent()
{
var practiceEvent = new PracticeEvent(_eventTitle, _eventDescription);
var testAttendee = new Attendee(_attendeeName, _atendeeEmail);
practiceEvent.AddAttendee(testAttendee);
practiceEvent.Attendees.Should().HaveCount(1);
}
}
}