public void GolfClubAdministratorSecurityUserCreatedEvent_CanBeCreated_IsCreated()
        {
            GolfClubAdministratorSecurityUserCreatedEvent golfClubAdministratorSecurityUserCreatedEvent = GolfClubAdministratorSecurityUserCreatedEvent.Create(
                GolfClubTestData.AggregateId,
                GolfClubTestData.GolfClubAdministratorSecurityUserId);

            golfClubAdministratorSecurityUserCreatedEvent.ShouldNotBeNull();
            golfClubAdministratorSecurityUserCreatedEvent.AggregateId.ShouldBe(GolfClubTestData.AggregateId);
            golfClubAdministratorSecurityUserCreatedEvent.EventCreatedDateTime.ShouldNotBe(DateTime.MinValue);
            golfClubAdministratorSecurityUserCreatedEvent.EventId.ShouldNotBe(Guid.Empty);
            golfClubAdministratorSecurityUserCreatedEvent.GolfClubAdministratorSecurityUserId.ShouldBe(GolfClubTestData.GolfClubAdministratorSecurityUserId);
        }
Beispiel #2
0
        /// <summary>
        /// Creates the admin user.
        /// </summary>
        /// <param name="golfClubAdminSecurityUserId">The golf club admin security user identifier.</param>
        public void CreateGolfClubAdministratorSecurityUser(Guid golfClubAdminSecurityUserId)
        {
            Guard.ThrowIfInvalidGuid(golfClubAdminSecurityUserId,
                                     typeof(ArgumentNullException),
                                     "A golf club admin security user id is required to create a club admin security user");

            this.CheckHasGolfClubAlreadyBeenCreated();
            this.CheckHasClubAdminSecurityUserAlreadyBeenCreated();

            // Create the domain event
            GolfClubAdministratorSecurityUserCreatedEvent golfClubAdministratorSecurityUserCreatedEvent =
                GolfClubAdministratorSecurityUserCreatedEvent.Create(this.AggregateId, golfClubAdminSecurityUserId);

            // Apply and pend
            this.ApplyAndPend(golfClubAdministratorSecurityUserCreatedEvent);
        }
Beispiel #3
0
 /// <summary>
 /// Handles the specific domain event.
 /// </summary>
 /// <param name="domainEvent">The domain event.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns></returns>
 private async Task HandleSpecificDomainEvent(GolfClubAdministratorSecurityUserCreatedEvent domainEvent,
                                              CancellationToken cancellationToken)
 {
     await this.Manager.InsertUserRecordToReadModel(domainEvent, cancellationToken);
 }
Beispiel #4
0
 /// <summary>
 /// Plays the event.
 /// </summary>
 /// <param name="domainEvent">The domain event.</param>
 private void PlayEvent(GolfClubAdministratorSecurityUserCreatedEvent domainEvent)
 {
     this.HasAdminSecurityUserBeenCreated     = true;
     this.GolfClubAdministratorSecurityUserId = domainEvent.GolfClubAdministratorSecurityUserId;
 }