コード例 #1
0
        public void DeveRetornarSucessoSeCommandValido(
            int clientId,
            string nome,
            string sobrenome,
            string email,
            string token,
            string empresa,
            string telefone,
            string title,
            string description,
            ETicketStatusType status,
            EPriorityType prioridade
            )
        {
            CreateTicketCommand command = new CreateTicketCommand
            {
                ClientId         = clientId,
                ClientFirstName  = nome,
                ClientLastName   = sobrenome,
                ClientEmail      = email,
                ClientToken      = token,
                ClientCompany    = empresa,
                ClientCallNumber = telefone,
                Title            = title,
                Description      = description,
                Status           = status,
                Priority         = prioridade
            };

            command.Validate();
            Assert.True(command.Valid);
        }
コード例 #2
0
        public Ticket(string code, string title, string description, ETicketStatusType status, EPriorityType priority, ClientUser client)
        {
            Code        = code;
            Title       = title;
            Description = description;
            Status      = status;
            Priority    = priority;
            Client      = client;
            OpenDate    = DateTime.UtcNow;
            _historics  = new List <Historic>();

            // Adiciona as notificações de validação dos value Objects
            AddNotifications(client,
                             new Contract()
                             .Requires()
                             .IsNotNullOrWhiteSpace(Code, "Ticket.Code", "O Código é obrigatório")
                             .HasMinLen(Title, 5, "Ticket.Title", "O título é obrigatório")
                             .HasMinLen(Description, 10, "Ticket.Description", "A descrição é obrigatório")
                             );
        }