public override void Create() { UserStoryDTO story = new UserStoryDTO { Name = this.EntityName, ProjectID = this.ProjectId }; if (IsDescriptionSet) { story.Description = this.Description; } if (!String.IsNullOrEmpty(this.State)) { story.EntityStateID = this.StateId; } int storyId = StoryService.Create(story); foreach (TargetProcessUser user in this.UsersToAssign) { StoryService.AssignUser(storyId, user.GetId()); } }
public async Task CreateIfStoryNull() { var userStories = new StoryService(_unitOfWorkMock.Object, _storyRepositoryMock.Object, _storfinderMock.Object, _userFinderMock.Object ); var result = await userStories.Create(null); Assert.IsTrue(result.Errors.First() == "Null Story"); }
public async Task CreateIfNotSave() { _storyRepositoryMock.Setup(x => x.Create(It.IsAny <Story>())) .Throws <System.ArgumentOutOfRangeException>(); _unitOfWorkMock.Setup(x => x.SaveAsync()) .Returns(Task.FromException(new Exception())); var userStories = new StoryService(_unitOfWorkMock.Object, _storyRepositoryMock.Object, _storfinderMock.Object, _userFinderMock.Object ); var result = await userStories.Create(story); Assert.IsFalse(result.Succeeded); }
public async Task CreateIfSuccess() { _storyRepositoryMock.Setup(x => x.Create(story)); _unitOfWorkMock.Setup(x => x.SaveAsync()).Returns(Task.CompletedTask); var userStories = new StoryService(_unitOfWorkMock.Object, _storyRepositoryMock.Object, _storfinderMock.Object, _userFinderMock.Object ); var result = await userStories.Create(story); Assert.IsTrue(result.Succeeded); }
public async Task <IActionResult> Create(CreateViewModel model) { if (!Guid.TryParse(CurrentUser.NameIdentifier, out Guid userId)) { return(Json(new { Status = false, Message = "Error adding story." })); } var validationResult = CreateViewModelValidator.Validate(model); if (!validationResult.IsValid) { return(Json(new { Status = validationResult.IsValid, Messages = validationResult.Messages })); } var summary = await StoryService.Create(model, CurrentUser.Name, userId); return(Json(new { Status = true })); }
private StoryCreateResult Create(IUser user, string url, string title, string category, string desriptions, string ipAddress, string userAgent) { return(_storyService.Create(user, url, title, category, desriptions, "dummy, C#", ipAddress, userAgent, null, new NameValueCollection { { "foo", "bar" } }, s => "http://dotnetshoutout.com/A-Dummy-Story")); }