public void ShouldReturnNull() { var environmentProvider = Substitute.For <IEnvironmentProvider>(); var environmentServiceProvider = new BuildServiceProvider(environmentProvider); environmentServiceProvider.GetBuildService().Should().BeNull(); }
public ProjectModel(string slug, string title, string subtitle, int rank, BuildServiceProvider provider) { Slug = slug; Title = title; Subtitle = subtitle; Rank = rank; Provider = provider; }
public void ShouldDetectJenkins() { var environmentProvider = Substitute.For <IEnvironmentProvider>(); environmentProvider.GetEnvironmentVariable("JENKINS_HOME").Returns(Faker.System.DirectoryPath()); var environmentServiceProvider = new BuildServiceProvider(environmentProvider); var environmentService = environmentServiceProvider.GetBuildService(); environmentService.Should().BeOfType <JenkinsBuildService>(); }
public void ShouldDetectCircle() { var environmentProvider = Substitute.For <IEnvironmentProvider>(); environmentProvider.GetEnvironmentVariable("CIRCLECI").Returns("True"); var environmentServiceProvider = new BuildServiceProvider(environmentProvider); var environmentService = environmentServiceProvider.GetBuildService(); environmentService.Should().BeOfType <CircleBuildService>(); }
public void ShouldDetectTravis() { var environmentProvider = Substitute.For <IEnvironmentProvider>(); environmentProvider.GetEnvironmentVariable("TRAVIS").Returns("True"); var environmentServiceProvider = new BuildServiceProvider(environmentProvider); var environmentService = environmentServiceProvider.GetBuildService(); environmentService.Should().BeOfType <TravisBuildService>(); }
public void ShouldDetectAppVeyor() { var environmentProvider = Substitute.For <IEnvironmentProvider>(); environmentProvider.GetEnvironmentVariable("APPVEYOR").Returns("True"); var environmentServiceProvider = new BuildServiceProvider(environmentProvider); var environmentService = environmentServiceProvider.GetBuildService(); environmentService.Should().BeOfType <AppVeyorBuildService>(); }
public override void Initialize(IEventSource eventSource) { var environmentProvider = new EnvironmentProvider(); var baseUrl = environmentProvider.GetEnvironmentVariable("BCC_URL") ?? "https://buildcrosscheck.azurewebsites.net"; var restClient = new RestClient(baseUrl); var submissionService = new SubmissionService(restClient); var buildServiceProvider = new BuildServiceProvider(environmentProvider); var buildService = buildServiceProvider.GetBuildService(); var parameterParser = new ParameterParser(environmentProvider, buildService); var logDataBuilderFactory = new LogDataBuilderFactory(); var fileSystem = new FileSystem(); Initialize(fileSystem, eventSource, environmentProvider, submissionService, parameterParser, logDataBuilderFactory); }
public static IBuildService Create(BuildServiceProvider which, IWebRequestFactory webFactory, IWebUtility netio, IGarbage garbage) { switch (which) { case BuildServiceProvider.AppVeyor: return(new AppVeyorBuildService(webFactory, netio)); case BuildServiceProvider.TeamCity: return(new TeamCityBuildService(webFactory, netio)); case BuildServiceProvider.Failing: return(new FailingBuildService()); case BuildServiceProvider.Succeeding: return(new SuceedingBuildService()); } throw new Exception("Invalid build service"); }
public static IBuildService Create(BuildServiceProvider which, IWebRequestFactory webFactory, IWebUtility netio, IGarbage garbage) { switch (which) { case BuildServiceProvider.AppVeyor: return new AppVeyorBuildService(webFactory, netio); case BuildServiceProvider.TeamCity: return new TeamCityBuildService(webFactory, netio); case BuildServiceProvider.Failing: return new FailingBuildService(); case BuildServiceProvider.Succeeding: return new SuceedingBuildService(); } throw new Exception("Invalid build service"); }
public void RejectInvalid() { const BuildServiceProvider provider = (BuildServiceProvider)9999; var av = BuildServiceFactory.Create(provider, _webFactory.Object, _netio.Object, _garbage.Object); }
private static void Main(string[] args) { while (true) { try { System.Console.WindowWidth = System.Console.LargestWindowWidth; System.Console.WindowHeight = System.Console.LargestWindowHeight; System.Console.ForegroundColor = ConsoleColor.Blue; System.Console.WriteLine("Demo technical test: Make that you read the readme.md"); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Select from the following options"); System.Console.WriteLine("..........................................................."); System.Console .WriteLine("1: Export data from cvs file and save it to a local database initially migrated. Console will mirror the database table"); System.Console .WriteLine("2: Export database records to json with payload on console"); System.Console .WriteLine("3: Export data from import csv to json with payload saved on /consoledata/export-addresses.json"); System.Console .WriteLine("4: Export data from import json to csv with payload saved on /consoledata/export-addresses.csv"); System.Console.ForegroundColor = ConsoleColor.White; var userInput = System.Console.ReadLine(); if (int.TryParse(userInput, out var selection)) { var addressService = BuildServiceProvider.GetService <IAddressService>(); switch (selection) { case (int)UserInput.CvsToDb: ProcessCvsAndSaveToDbAndConsoleDisplayResults(addressService); break; case (int)UserInput.DbToJson: ConvertDbRecordsToJsonAndConsoleDisplayResults(addressService); break; case (int)UserInput.CsvToJson: ExportCsvToJsonInFileInConsoleDataDirectory(addressService); break; case (int)UserInput.JsonToCsv: ExportJsonToCsvInFileConsoleDataDirectory(addressService); break; default: throw new Exception("Enter values between 1-4 from the options above"); } } else { throw new Exception("Invalid user input.Enter values between 1-4 from the options above"); } } catch (Exception e) { System.Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine(e.Message); ClearScreenAfterInteraction("Press any key to proceed"); } } }