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"); }
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 }); }