public async Task <IActionResult> CreateBranch([FromBody] CreateBranchRequest request)
        {
            var createBranchCommand = new CreateBranchCommand(request);
            var result = await mediator.Send(createBranchCommand);

            return(StatusCode((int)result.Code, result.Value));
        }
Exemplo n.º 2
0
        public async Task Should_Persist_Branch_To_DB_Test()
        {
            //Arrange
            var command = new CreateBranchCommand
            {
                Name         = "Create Test Branch",
                Phone1       = "Create Phone1",
                Phone2       = "Create Phone2",
                AddressLine1 = "Create AddressLine1",
                AddressLine2 = "Create AddressLine2",
                City         = "Create City",
                Country      = "Create Country"
            };

            var handler = new CreateBranchCommandHandler(_dbContext);
            //Act
            var result = await handler.Handle(command, CancellationToken.None);

            var entity = _dbContext.Branches.Find(result);

            //Assert

            result.ShouldNotBeNull();
            result.ShouldBeOfType <Guid>();
            entity.ShouldNotBeNull();
        }
Exemplo n.º 3
0
        /// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
        /// <exception cref="NGit.Api.Errors.RefAlreadyExistsException"></exception>
        /// <exception cref="NGit.Api.Errors.RefNotFoundException"></exception>
        /// <exception cref="NGit.Api.Errors.InvalidRefNameException"></exception>
        public virtual Ref CreateBranch(Git actGit, string name, bool force, string startPoint
			, CreateBranchCommand.SetupUpstreamMode? mode)
        {
            CreateBranchCommand cmd = actGit.BranchCreate();
            cmd.SetName(name);
            cmd.SetForce(force);
            cmd.SetStartPoint(startPoint);
            cmd.SetUpstreamMode(mode != null ? mode.Value : CreateBranchCommand.SetupUpstreamMode.NOT_SET);
            return cmd.Call();
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Post([FromBody] CreateBranchCommand command)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            var response = await this._mediator.Send(command);

            return(this.Created(Url.RouteUrl("GetBranchById", new { id = response.Id }), new { id = response.Id }));
        }
Exemplo n.º 5
0
 private void OnToolStripButtonCreateBranchClick(object sender, EventArgs e)
 {
     SvnExplorer svnExplorer = new SvnExplorer();
     svnExplorer.TrunkSubTagOrSubBranchOnly = true;
     if (svnExplorer.ShowDialog(this) == DialogResult.OK)
     {
         IUICommand command = new CreateBranchCommand(svnExplorer.GetSvnExplorerSelection());
         RunSynchronousCommand(command);
     }
 }
 public async Task <ActionResult> CreateBranchAsync([FromBody] CreateBranchCommand command)
 {
     return(Ok(await CommandAsync(command)));
 }