public void UserProfileTestCorrect()
        {
            var userProfileAggregate = new ProfileAggregate(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.ProfilePictureUrl.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");
        }
        public void UserProfileTestCorrect()
        {
            var userProfileAggregate = new ProfileAggregate(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.CreateKweetAsync("- Sup\nheyhey\n1.hey");
            userProfileAggregate.DisplayName.Should().Be("test");
            userProfileAggregate.Kweets.Should().Contain(k => k.Message == "- Sup\nheyhey\n1.hey");
            userProfileAggregate.ProfilePictureUrl.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");
        }
Beispiel #3
0
        public async Task ConsumeAsync(CreatedUserIntegrationEvent message, CancellationToken cancellationToken)
        {
            ProfileAggregate aggregate = new ProfileAggregate(message.UserId, message.DisplayName, message.Image);

            _kweetRepository.Add(aggregate);
            bool success = await _kweetRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);

            if (!success)
            {
                throw new Exception("Failed to create user");
            }
        }
Beispiel #4
0
        public static ProfileResponse ToDto(this ProfileAggregate profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }

            return(new ProfileResponse
            {
                AuthUrl = profile.AuthUrl,
                OpenidUrl = profile.OpenidUrl,
                ScimUrl = profile.ScimUrl
            });
        }
Beispiel #5
0
        public async Task <CommandResponse> Handle(CreateKweetCommand request, CancellationToken cancellationToken)
        {
            ProfileAggregate aggregate = await _kweetRepository.GetAsync(request.UserId, cancellationToken);

            Kweet kweet = aggregate.CreateKweetAsync(request.Message);

            kweet = _kweetRepository.TrackKweet(kweet);

            var success = await _kweetRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken);

            return(new CommandResponse
            {
                Success = success
            });
        }
Beispiel #6
0
        public async Task <bool> Execute(ProfileAggregate profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }

            var pr = await _profileRepository.Get(profile.Subject);

            if (pr == null)
            {
                return(await _profileRepository.Add(new[] { profile }));
            }

            return(await _profileRepository.Update(new[] { profile }));
        }
Beispiel #7
0
 public ProfileAggregate Add(ProfileAggregate userProfile)
 {
     return(_context.Profile.Add(userProfile).Entity);
 }
Beispiel #8
0
        public IAggregate Handle(CreateProfile command)
        {
            var user = _userService.GetById(command.UserId);

            return(ProfileAggregate.Create(command.Id, user, command.ChartId, command.Name, command.Track, _dateTimeProvider, _placeFinder, _elevationService));
        }
Beispiel #9
0
 public Task <bool> Update(ProfileAggregate profile)
 {
     return(_updateProfileAction.Execute(profile));
 }