public async Task <Unit> Handle(CreateUser request, CancellationToken cancellationToken) { var user = RegisteredUser.Create(Guid.NewGuid(), "3213212", request.Username, request.Email, request.Password); await _usersRepository.Save(user); return(Unit.Value); }
public void Comment_CreateComment_ReturnsNewComment() { var user = RegisteredUser.Create(Guid.NewGuid(), "*****@*****.**", "fdjkslfjlsd", "user1", "cantbenull"); var comment = Comment.Create(Guid.NewGuid(), "some comment", user); Assert.NotNull(comment); Assert.IsType <Comment>(comment); }
public void Author_AddComment_CreatesConnectionBetweenObjects() { var user = RegisteredUser.Create(Guid.NewGuid(), "*****@*****.**", "fdjkslfjlsd", "user1", "cantbenull"); var comment = Comment.Create(Guid.NewGuid(), "some comment", user); user.AddComment(comment); Assert.Equal(user, comment.Author); Assert.Equal(comment.Author, user); }
public void Article_AddComment_CreatesConnectionBetweenObjects() { var category = new Category(Guid.NewGuid(), "Sports"); var user = RegisteredUser.Create(Guid.NewGuid(), "*****@*****.**", "fdjkslfjlsd", "user1", "cantbenull"); var comment = Comment.Create(Guid.NewGuid(), "some comment", user); var article = Article.Create(Guid.NewGuid(), "Default title", "description", "body", category, ContentState.Created); article.AddComment(comment); Assert.Equal(user, comment.Author); Assert.Equal(article, comment.Content); Assert.Contains(comment, article.Comments); Assert.Contains(comment, user.UserComments); }
public async Task CanCompileEmail() { var container = new DataSeedDiContainer(); var emailTemplateRegister = container.Container.GetInstance <EmailTemplateRegister>(); var user = RegisteredUser.Create(1, "jack"); var workItem = new WorkItem("do magic", user); var model = new CategoryCreatedTemplate.Model(workItem, new AppConfig()); var email = await emailTemplateRegister.CompileEmail( "*****@*****.**", model); email.Should().NotBeNull(); }
public async Task CanCompileEmail() { var container = new DataSeedDiContainer(); var emailTemplateRegister = container.Container.GetInstance <EmailTemplateRegister>(); var user = RegisteredUser.Create(1, "jack"); var activityType = new ActivityType("do magic", user.Id, "SP", 1, null, null); var activity = new Activity(user.Id, activityType, 1, null, DateTime.Today); var model = new ActivityRecordedTemplate.Model(activity, new AppConfig()); var email = await emailTemplateRegister.CompileEmail( "*****@*****.**", model); email.Should().NotBeNull(); }
public static RegisteredUser AsEntity(this UserDocument userDocument) => RegisteredUser.Create(userDocument.Id, "321321", userDocument.Username, userDocument.Email, userDocument.Password, userDocument.Comments.AsEntity(userDocument).ToHashSet());