예제 #1
0
        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());
            }
        }
예제 #2
0
        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");
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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 }));
        }
예제 #6
0
 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"));
 }