public void UserProfileTestEmptyDescription() { var userProfileAggregate = new UserProfileAggregate(Guid.NewGuid(), "test", "", "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png"); userProfileAggregate.DisplayName.Should().Be("test"); userProfileAggregate.UserProfile.Description.Should().Be(""); userProfileAggregate.UserProfile.Image.Should().Be("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1200px-Image_created_with_a_mobile_phone.png"); userProfileAggregate.DomainEvents.Should().NotBeEmpty().And.HaveCount(2); userProfileAggregate.UserProfile.DomainEvents.Should().NotBeEmpty().And.HaveCount(3); }
private async Task CheckUserIdUniquenessAsync(Guid proposedUserId, ValidationContext <CreateUserProfileCommand> context, CancellationToken cancellationToken) { // Checks whether the user id is empty. if (proposedUserId == Guid.Empty) { context.AddFailure("The user id can not be empty."); return; } // Checks whether the user id already exists. UserProfileAggregate userAggregate = await _userRepository.GetAsync(proposedUserId, cancellationToken); if (userAggregate != default) { context.AddFailure("A user with the proposed user id already exists."); return; } }
public UserProfileAggregate Update(UserProfileAggregate userProfile) { return(_context.Update(userProfile).Entity); }
public UserProfileAggregate Add(UserProfileAggregate userProfile) { return(_context.UserProfiles.Add(userProfile).Entity); }