public static ProjectUpdateCommandBuilder Start()
        {
            _command = new ProjectUpdateCommand()
            {
            };

            return(new ProjectUpdateCommandBuilder());
        }
Пример #2
0
        public async Task <IActionResult> UpdatProjectsPortifolio(int id)

        {
            var productCmd = new ProjectUpdateCommand()
            {
                Id          = id,
                Description = "descriptionnnn",
                Name        = "Nameee",
                PersonId    = 1101109046
                              //productCustomers = new List<CustomerUpdateCommand>() { new CustomerUpdateCommand() { Name = "Roberto", LastName = "Bola", Sex = SexEnum.Male } }
            };

            var myContent     = JsonConvert.SerializeObject(productCmd);
            var stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json");

            var result = await client.PutAsync($"https://localhost:44301/api/projects", stringContent);

            return(Ok());
        }
        public void UpdateProject_IntegrationTest()
        {
            var ProjectReservationCmd = new ProjectUpdateCommand()
            {
                Id          = 1,
                Description = "Teste atualização",
                PersonId    = 1
            };
            var myContent     = JsonConvert.SerializeObject(ProjectReservationCmd);
            var stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json");

            var httpResponse = _client.PutAsync($"{_url}", stringContent).Result;

            httpResponse.EnsureSuccessStatusCode();

            var projectReservationUpdated = CustomWebApplicationFactory <Startup> .appDb.Project.Find(1);

            //projectReservationUpdated.Description.Should().Be("Teste atualização");
        }
        public void ProjectUpdateCommandHandler_Handle()
        {
            var originalValue = FakeObjects.TestProjectWithId();
            var team = FakeObjects.TestTeamWithId();
            var user = FakeObjects.TestUserWithId();

            Project newValue;

            var command = new ProjectUpdateCommand()
            {
                Description = FakeValues.Description,
                Name = FakeValues.Name,
                UserId = user.Id,
                TeamId = team.Id,
                Id = originalValue.Id
            };

            using (var session = _store.OpenSession())
            {
                session.Store(originalValue);
                session.Store(team);
                session.Store(user);

                var commandHandler = new ProjectUpdateCommandHandler(session);

                commandHandler.Handle(command);

                session.SaveChanges();

                newValue = session.Load<Project>(originalValue.Id);
            }

            Assert.IsNotNull(newValue);
            Assert.AreEqual(command.Name, newValue.Name);
            Assert.AreEqual(command.Description, newValue.Description);
            //Assert.AreEqual(team.DenormalisedNamedDomainModelReference<Team>(), newValue.Team);
        }
Пример #5
0
        public void ProjectUpdateCommandHandler_Handle()
        {
            var originalValue = FakeObjects.TestProjectWithId();
            var team          = FakeObjects.TestTeamWithId();
            var user          = FakeObjects.TestUserWithId();

            Project newValue;

            var command = new ProjectUpdateCommand()
            {
                Description = FakeValues.Description,
                Name        = FakeValues.Name,
                UserId      = user.Id,
                TeamId      = team.Id,
                Id          = originalValue.Id
            };

            using (var session = _store.OpenSession())
            {
                session.Store(originalValue);
                session.Store(team);
                session.Store(user);

                var commandHandler = new ProjectUpdateCommandHandler(session);

                commandHandler.Handle(command);

                session.SaveChanges();

                newValue = session.Load <Project>(originalValue.Id);
            }

            Assert.IsNotNull(newValue);
            Assert.AreEqual(command.Name, newValue.Name);
            Assert.AreEqual(command.Description, newValue.Description);
            //Assert.AreEqual(team.DenormalisedNamedDomainModelReference<Team>(), newValue.Team);
        }
        public async Task <IActionResult> Update(ProjectUpdateCommand projectUpdateCmd)
        {
            var result = await _mediator.Send(projectUpdateCmd);

            return(Ok(result));
        }