public void Should_be_able_to_create_an_event() { //Arrange DefineInstances(); var qtdPessoas = new QuantidadePessoas(15); var email = new Email("*****@*****.**"); var evento = new Evento(null, "Campo grande, MS", DateTime.Now.AddDays(20), ".NET Core", qtdPessoas, "img3.jpg", "6799999999", email, new List <Lote>(), new List <RedeSocial>()); //Act _repository.Adicionar(evento); var salvouComSucesso = _repository.Commitar().Result; //Assert evento.Id.Should().NotBe(0); salvouComSucesso.Should().Be(true); }
public Evento(int?id, string local, DateTime dataEvento, string tema, QuantidadePessoas qtdPessoas, string imagemUrl, string telefone, Email email, List <Lote> lotes, List <RedeSocial> redesSociais) { if (id.HasValue) { Id = id.Value; } Local = local; DataEvento = dataEvento; Tema = tema; QtdPessoas = qtdPessoas; ImagemUrl = imagemUrl; Telefone = telefone; Email = email; Lotes = lotes; RedesSociais = redesSociais; AddNotifications(Email, QtdPessoas); }
public async Task <CommandResponse> Handle(ExcluirEventoCommand command, CancellationToken cancellationToken) { var qtdPessoas = new QuantidadePessoas(command.QtdPessoas); var email = new Email(command.Email); var evento = new Evento(command.Id, command.Local, Convert.ToDateTime(command.DataEvento), command.Tema, qtdPessoas, command.ImagemUrl, command.Telefone, email, command.Lotes, command.RedesSociais); _repository.Excluir(evento); if (await _repository.Commitar()) { Response.Success = true; Response.Messages.Add("Evento excluído com sucesso!"); return(Response); } Response.Success = false; Response.Messages.AddRange(evento.Notifications.Select(x => x.Message)); return(Response); }
public QuantidadePessoasValidation(QuantidadePessoas quantidadePessoas) { _quantidadePessoas = quantidadePessoas; }