コード例 #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
ファイル: StoryServiceFixture.cs プロジェクト: aoki1210/kigg
 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"));
 }