public void After_accepting_invitation__HasSignedUpForTraining_is_true()
        {
            // Arrange
            var id     = EnrollmentAggregate.EnrollmentId.New;
            var event1 = new DomainEvent <EnrollmentAggregate, EnrollmentAggregate.EnrollmentId, RecruitmentFormSubmitted>(
                new RecruitmentFormSubmitted(
                    NodaTime.SystemClock.Instance.GetCurrentInstant(),
                    "Andrzej", "Strzelba",
                    EmailAddress.Parse("*****@*****.**"), Consts.FakePhoneNumber,
                    "ala ma kota", 1, "małopolskie", new[] { "Wadowice" }, new[] { 1 }, true),
                new Metadata(), DateTimeOffset.Now, id, 1
                );
            var event2 = new DomainEvent <EnrollmentAggregate, EnrollmentAggregate.EnrollmentId, CandidateRefusedTrainingInvitation>(
                new CandidateRefusedTrainingInvitation(Guid.NewGuid(), CommunicationChannel.OutgoingEmail, "kandydat nie ma czasu", string.Empty),
                new Metadata(), DateTimeOffset.Now, id, 2
                );
            var training   = CreateTrainingInFutureWithId(1);
            var enrollment = new EnrollmentAggregate(id);

            enrollment.ApplyEvents(new IDomainEvent[] { event1, event2 });
            var recordingCoordinator = new Models.Users.ApplicationUser()
            {
                Id = Guid.NewGuid()
            };

            // Act
            var result = enrollment.RecordCandidateAcceptedTrainingInvitation(
                new RecordAcceptedTrainingInvitation.Command()
            {
                EnrollmentId         = enrollment.Id.GetGuid(),
                CommunicationChannel = CommunicationChannel.OutgoingPersonalContact,
                AdditionalNotes      = "brak notatek",
                SelectedTrainingID   = training.ID
            },
                recordingCoordinator,
                new[] { training },
                NodaTime.SystemClock.Instance.GetCurrentInstant());

            // Assert
            Assert.True(result.IsSuccess);
            Assert.True(enrollment.HasSignedUpForTraining(training));
        }
        public void After_refusing_invitation__candidate_is_not_signed_up_for_training()
        {
            // Arrange
            var id     = EnrollmentAggregate.EnrollmentId.New;
            var event1 = new DomainEvent <EnrollmentAggregate, EnrollmentAggregate.EnrollmentId, RecruitmentFormSubmitted>(
                new RecruitmentFormSubmitted(
                    SystemClock.Instance.GetCurrentInstant(),
                    "Andrzej", "Strzelba",
                    EmailAddress.Parse("*****@*****.**"), Consts.FakePhoneNumber,
                    "ala ma kota", 1, "Wolne Miasto Gdańsk", new[] { "Wadowice" }, new[] { 1 }, true),
                new Metadata(), DateTimeOffset.Now, id, 1
                );
            var event2 = new DomainEvent <EnrollmentAggregate, EnrollmentAggregate.EnrollmentId, CandidateAcceptedTrainingInvitation>(
                new CandidateAcceptedTrainingInvitation(Guid.NewGuid(), CommunicationChannel.OutgoingEmail, 1, string.Empty),
                new Metadata(), DateTimeOffset.Now, id, 2
                );
            var enrollment = new EnrollmentAggregate(id);

            enrollment.ApplyEvents(new IDomainEvent[] { event1, event2 });
            var recordingCoordinator = new Models.Users.ApplicationUser()
            {
                Id = Guid.NewGuid()
            };
            var training = CreateTrainingWithIdAndDaysOffset(1, 1);

            // Act
            var command = new RecordRefusedTrainingInvitation.Command()
            {
                EnrollmentId         = enrollment.Id.GetGuid(),
                CommunicationChannel = CommunicationChannel.OutgoingPersonalContact,
                RefusalReason        = "brak powodu",
                AdditionalNotes      = "brak notatek"
            };
            var result = enrollment.RecordCandidateRefusedTrainingInvitation(command, recordingCoordinator, new[] { training }, SystemClock.Instance.GetCurrentInstant());

            // Assert
            Assert.True(result.IsSuccess);
            enrollment.HasSignedUpForTraining(training).Should().BeFalse();
        }