static void Main(string[] args)
        {
            UIIntegration        uIIntegration = new UIIntegration();
            DataStoreIntegration dsIntegration = new DataStoreIntegration();
            ProjectIntegration   prIntegration = new ProjectIntegration();

            uIIntegration.RunTests();
            dsIntegration.RunTests();
            prIntegration.RunTests();
        }
Beispiel #2
0
        public ProjectIntegration Create(CreateProjectIntegrationCommand command)
        {
            var projectIntegration = new ProjectIntegration(command);

            projectIntegration.CreateProjectIntegration(projectIntegration);

            _repository.Create(projectIntegration);

            if (Commit())
            {
                return(projectIntegration);
            }

            return(null);
        }
Beispiel #3
0
 /// <summary>
 /// Método para realizar todas as validações na criação de uma integração
 /// </summary>
 /// <param name="projectIntegration">Entidade para Integração do projeto</param>
 /// <returns>Retorna true caso todas as validações sejam satisfeitas</returns>
 public static bool CreateProjectIntegrationScopeIsValid(this ProjectIntegration projectIntegration)
 {
     return(AssertionConcern.IsSatisfiedBy
            (
                AssertionConcern.AssertGuidIsNotEmpty(projectIntegration.ProjectIntegrationId, "O ID do ProjectIntegration não pode ser vazio"),
                AssertionConcern.AssertLength(projectIntegration.Username, 3, 50, "O Username precisa ter no mínimo 3 caracteres e no máximo 50"),
                AssertionConcern.AssertNotEmpty(projectIntegration.Username, "O Nome de usuário da integração não pode ser vazio"),
                AssertionConcern.AssertLength(projectIntegration.ServerPath, 5, 140, "O caminho do servidor precisa ter no mínimo 5 caracteres e no máximo 140"),
                AssertionConcern.AssertNotEmpty(projectIntegration.ServerPath, "O caminho do servidor da integração não pode ser vazio"),
                AssertionConcern.AssertLength(projectIntegration.Password, 3, 32, "A senha precisa ter no mínimo 3 caracteres e no máximo 32"),
                AssertionConcern.AssertNotEmpty(projectIntegration.Password, "A senha da integração não pode ser vazio"),
                AssertionConcern.AssertIsGreaterThan(projectIntegration.MigrationInterval, 1, "O intervalo de migração precisa ser maior que 0."),
                AssertionConcern.AssertTrue(projectIntegration.DeleteFile == true || projectIntegration.DeleteFile == false, "Um valor booleano precisa ser especificado para o campo DeleteFile")
            ));
 }
        /// <summary>
        /// Método para verificar se a Integração do Projeto deve ser executada
        /// </summary>
        /// <param name="projectIntegration">ProjectIntegration que a integração vai executar</param>
        /// <returns>Retorna true caso a integração deva ser executada</returns>
        public bool CheckExecuteIntegration(ProjectIntegration projectIntegration)
        {
            // Data da próxima migração
            DateTime NextMigration;

            switch (projectIntegration.IntervalType)
            {
            case EProjectIntegrationIntervalType.Day:
            {
                NextMigration = projectIntegration.LastMigrationDate.AddDays(projectIntegration.MigrationInterval);

                if (DateTime.Now.Equals(NextMigration))
                {
                    return(true);
                }

                break;
            }

            case EProjectIntegrationIntervalType.Hour:
            {
                NextMigration = projectIntegration.LastMigrationDate.AddHours(projectIntegration.MigrationInterval);
                if (DateTime.Now.Equals(NextMigration))
                {
                    return(true);
                }

                break;
            }

            case EProjectIntegrationIntervalType.Minutes:
            {
                NextMigration = projectIntegration.LastMigrationDate.AddMinutes(projectIntegration.MigrationInterval);
                if (DateTime.Now.Equals(NextMigration))
                {
                    return(true);
                }

                break;
            }

            default:
                return(false);
            }

            return(false);
        }
 /// <summary>
 /// Método para atualizar ProjectIntegration
 /// </summary>
 /// <param name="projectIntegration">ProjectIntegration a ser atualizado</param>
 public void Update(ProjectIntegration projectIntegration)
 {
     _context.Entry(projectIntegration).State = EntityState.Modified;
 }
 /// <summary>
 /// Método para remover ProjectIntegration
 /// </summary>
 /// <param name="projectIntegration">ProjectIntegration a ser atualizado</param>
 public void Delete(ProjectIntegration projectIntegration)
 {
     _context.ProjectIntegrations.Remove(projectIntegration);
 }
 /// <summary>
 /// Método para criar ProjectIntegration
 /// </summary>
 /// <param name="projectIntegration">ProjectIntegration a ser criado</param>
 public void Create(ProjectIntegration projectIntegration)
 {
     _context.ProjectIntegrations.Add(projectIntegration);
 }
 /// <summary>
 /// Método para executar a Integração do Projeto
 /// </summary>
 /// <param name="projectIntegration">ProjectIntegration que a integração vai executar</param>
 /// <returns>Retorna true caso a integração tenha sido executada com sucesso</returns>
 public bool ExecuteIntegration(ProjectIntegration projectIntegration)
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
 /// <summary>
 /// Método para realizar todas as validações na atualização de uma integração
 /// </summary>
 /// <param name="projectIntegration">Integração a ser atualizada</param>
 /// <returns>Retorna true caso todas as validações sejam satisfeitas</returns>
 public static bool UpdateProjectIntegrationScopeIsValid(this ProjectIntegration projectIntegration)
 {
     return(projectIntegration.CreateProjectIntegrationScopeIsValid());
 }