public void ShouldBeExceptionWhenRetrieveProjects()
        {
            var logger = (ListLogger)LogFactory.CreateLogger(LoggerTypes.List);

            var projectRepository = ProjectsRepositoryConfig
                                    .Instance()
                                    .NotSaveWithException()
                                    .Build();

            var azureRepository = AzureDevopsRepositoryConfig
                                  .Instance()
                                  .GetData(new Response <Project>
            {
                value = new List <Project> {
                    new Project {
                        Id             = Guid.NewGuid(),
                        Name           = "Project Name",
                        LastUpdateTime = DateTime.UtcNow,
                        Description    = "Project Test"
                    }
                }
            })
                                  .Build();

            GetProjects.Container = ContainerBuilder
                                    .Instance()
                                    .SetProjectsRepository(projectRepository)
                                    .SetAzureDevopsRepository(azureRepository)
                                    .Build();

            GetProjects.Run(null, logger).GetAwaiter().GetResult();

            Assert.Contains("Ocorreu erro na execucao", logger.Logs);
        }
Exemplo n.º 2
0
        public void ShouldBeRetrieveBuilds()
        {
            var logger = (ListLogger)LogFactory.CreateLogger(LoggerTypes.List);

            var buildRepository = BuildsRepositoryConfig
                                  .Instance()
                                  .Save()
                                  .Build();

            var repository = RepositoriesRepositoryConfig
                             .Instance()
                             .List()
                             .Build();

            var azureRepository = AzureDevopsRepositoryConfig
                                  .Instance()
                                  .GetData(new Response <Build>
            {
                value = new List <Build> {
                    new Build {
                        Id         = 1,
                        Name       = "Teste",
                        Repository = new Repository {
                            Id   = Guid.NewGuid(),
                            Name = "Repository Test"
                        }
                    }
                }
            })
                                  .GetData(new Build {
                Id         = 1,
                Name       = "Teste",
                Repository = new Repository
                {
                    Id   = Guid.NewGuid(),
                    Name = "Repository Test"
                }
            })
                                  .Build();

            GetBuildsDefinition.Container = ContainerBuilder
                                            .Instance()
                                            .SetBuildsRepository(buildRepository)
                                            .SetRepositoriesRepository(repository)
                                            .SetAzureDevopsRepository(azureRepository)
                                            .Build();

            GetBuildsDefinition.Run(null, logger).GetAwaiter().GetResult();

            var msg = logger.Logs.LastOrDefault();

            Assert.Contains("Builds Capturados", msg);
        }
Exemplo n.º 3
0
        public void ShouldBeExceptionWhenSaveBuilds()
        {
            var logger = (ListLogger)LogFactory.CreateLogger(LoggerTypes.List);

            var buildRepository = BuildsRepositoryConfig
                                  .Instance()
                                  .NotSaveWithException()
                                  .Build();

            var azureRepository = AzureDevopsRepositoryConfig
                                  .Instance()
                                  .GetData(new Response <Build>
            {
                value = new List <Build> {
                    new Build {
                        Id         = 1,
                        Name       = "Teste",
                        Repository = new Repository {
                            Id   = Guid.NewGuid(),
                            Name = "Repository Test"
                        }
                    }
                }
            })
                                  .GetData(new Build
            {
                Id         = 1,
                Name       = "Teste",
                Repository = new Repository
                {
                    Id   = Guid.NewGuid(),
                    Name = "Repository Test"
                }
            })
                                  .Build();

            var repository = RepositoriesRepositoryConfig
                             .Instance()
                             .List()
                             .Build();

            GetBuildsDefinition.Container = ContainerBuilder
                                            .Instance()
                                            .SetBuildsRepository(buildRepository)
                                            .SetRepositoriesRepository(repository)
                                            .SetAzureDevopsRepository(azureRepository)
                                            .Build();

            GetBuildsDefinition.Run(null, logger).GetAwaiter().GetResult();

            Assert.Contains("Ocorreu erro na execucao", logger.Logs);
        }
        public void ShouldBeRetrieveRepositories()
        {
            var logger = (ListLogger)LogFactory.CreateLogger(LoggerTypes.List);

            var repository = RepositoriesRepositoryConfig
                             .Instance()
                             .Save()
                             .Build();

            var azureRepository = AzureDevopsRepositoryConfig
                                  .Instance()
                                  .GetData(new Response <Project>
            {
                value = new List <Project> {
                    new Project {
                        Id             = Guid.NewGuid(),
                        Name           = "Project Name",
                        LastUpdateTime = DateTime.UtcNow,
                        Description    = "Project Test"
                    }
                }
            })
                                  .GetData(new Response <Repository>
            {
                value = new List <Repository> {
                    new Repository {
                        Id      = Guid.NewGuid(),
                        Name    = "Project Name",
                        Project = new Project {
                            Id             = Guid.NewGuid(),
                            Name           = "Project Name",
                            LastUpdateTime = DateTime.UtcNow,
                            Description    = "Project Test"
                        }
                    }
                }
            })
                                  .Build();


            GetRepositories.Container = ContainerBuilder
                                        .Instance()
                                        .SetRepositoriesRepository(repository)
                                        .SetAzureDevopsRepository(azureRepository)
                                        .Build();

            GetRepositories.Run(null, logger).GetAwaiter().GetResult();

            var msg = logger.Logs.LastOrDefault();

            Assert.Contains("Repositorios Capturados", msg);
        }