public void DotNet6_Root_Update1() { // Arrange using var logger = testOutput.BuildLogger(); var outputFile = PrepareOutputFile("test1.txt"); var expectedContent = GetContentFromTestFile("Result_DotNet6_Root_1a.txt"); var contentGit = GetContentFromTestFile("Git_DotNet6_Root_1c.txt"); var contentFile = GetContentFromTestFile("Git_DotNet6_Root_1a.txt"); // Act EditorConfigHelper.HandleFile( logger, "log-area", contentGit, contentFile, "log-description-part", outputFile); var actual = FileHelper.ReadAllText(outputFile); // Assert Assert.Equal(expectedContent, actual); logger.Entries .Should().HaveCount(1) .And.Subject.Should().Contain(x => x.Message.Contains("log-description-part files merged")); }
public NameFilterTests(ITestOutputHelper output) { this.logger = output.BuildLogger(); this.filter = new NameFilter(); this.servers = new Server[] { new ShadowsocksServer() { Name = "goodserver 1" }, new ShadowsocksServer() { Name = "goodserver 2" }, new ShadowsocksServer() { Name = "goodserver 3" }, new ShadowsocksServer() { Name = "badserver 1" }, new ShadowsocksServer() { Name = "badserver 2" }, }; }
protected WebsocketTestBase(ITestOutputHelper testOutputHelper, int port) { Logger = testOutputHelper.BuildLogger(); _port = port; Url = $"{Host}:{port}"; _server = new WebSocketServer(Url) { RestartAfterListenError = false }; try { _server.Start(socket => { _webSocketConnection = socket; socket.OnOpen = () => testOutputHelper.WriteLine("Server Connection OnOpen."); socket.OnClose = () => testOutputHelper.WriteLine("Server Connection OnClose."); socket.OnMessage = message => socket.Send(message); socket.OnBinary = bytes => socket.Send(bytes); }); Logger.LogInformation("Server start success."); } catch (Exception e) { Logger.LogError(e.Message, e); } }
protected CertifyTest(ITestOutputHelper iTestOutputHelper) { Logger = iTestOutputHelper.BuildLogger(); var testConfig = new TestConfig(Logger); CertifyClient = testConfig.CertifyClient; }
protected BaseTest(ITestOutputHelper testOutputHelper) { // Create logger Logger = testOutputHelper.BuildLogger(); // Load config var config = JsonConvert.DeserializeObject <TestConfiguration>(File.ReadAllText("../../../appsettings.json")); if (config == null) { throw new System.Exception("Could not load test configuration"); } // Set and validate the options var options = new ErrigalClientOptions { Url = config.Url, Username = config.Username, Password = config.Password, }; // Create client Client = new ErrigalClient(options, Logger); // Store the username for test data Username = config.Username !; }
public DynamicsTests(ITestOutputHelper output) { var services = TestHelper.CreateDIContainer(output).AddTestCache(); options = new DynamicsOptions { DynamicsApiBaseUri = new Uri("https://no.where"), DynamicsApiEndpoint = new Uri("https://no.where"), CircuitBreakerNumberOfErrors = 5, CircuitBreakerResetInSeconds = 1 }; var config = new ConfigurationBuilder().AddConfigurationOptions("dynamics", options).Build(); new Configuration().ConfigureServices(new EMBC.Utilities.Configuration.ConfigurationServices { Services = services, Environment = new HostingEnvironment { EnvironmentName = Environments.Development }, Logger = output.BuildLogger(), Configuration = config }); services.AddTransient(sp => A.Fake <ISecurityTokenProvider>()); services.AddTransient <IEssContextStateReporter, EssContextStateReporter>(); this.services = services.BuildServiceProvider(validateScopes: true); }
public InterfaceDefinitionTests(ITestOutputHelper output) { _output = output; var logger = output.BuildLogger(LogLevel.Information); _calculator = ChangeCalculatorFactory.BuildCalculator(logger); }
public void BuildLoggerLogsAccordingToLogLevel(LogLevel configuredLevel, LogLevel logLevel, bool isEnabled) { var logger = _output.BuildLogger(configuredLevel); logger.Should().BeAssignableTo <ILogger>(); logger.Log(logLevel, "Hey, does this work? Check the test trace log."); if (isEnabled) { logger.Entries.Should().HaveCount(1); } else { logger.Entries.Should().BeEmpty(); } }
/// <summary> /// Constructs a ServiceNowClient /// </summary> /// <param name="iTestOutputHelper"></param> /// <param name="appsettingsFilename"></param> /// <param name="options"></param> protected ServiceNowTest( ITestOutputHelper iTestOutputHelper, string appsettingsFilename = "appsettings.json", Options?options = null) { options ??= new(); Logger = iTestOutputHelper.BuildLogger(); options.Logger = Logger; // Locate the configuration file path at the root of the test project, relative from where these assemblies were deployed var configurationJsonFilePath = Path.Combine(Path.GetDirectoryName(typeof(ServiceNowTest).GetTypeInfo().Assembly.Location) ?? string.Empty, "../../.."); var configurationRoot = new ConfigurationBuilder() .SetBasePath(configurationJsonFilePath) .AddJsonFile(appsettingsFilename, optional: false, reloadOnChange: false) .Build(); var config = new TestConfiguration { ServiceNowAccount = configurationRoot["ServiceNowAccount"], ServiceNowUsername = configurationRoot["ServiceNowUsername"], ServiceNowPassword = configurationRoot["ServiceNowPassword"], ServiceNowEnvironment = configurationRoot["ServiceNowEnvironment"] }; if (string.IsNullOrWhiteSpace(config.ServiceNowAccount)) { throw new Exception($"{nameof(TestConfiguration)}.{nameof(TestConfiguration.ServiceNowAccount)} must be set."); } if (string.IsNullOrWhiteSpace(config.ServiceNowUsername)) { throw new Exception($"{nameof(TestConfiguration)}.{nameof(TestConfiguration.ServiceNowUsername)} must be set."); } if (string.IsNullOrWhiteSpace(config.ServiceNowPassword)) { throw new Exception($"{nameof(TestConfiguration)}.{nameof(TestConfiguration.ServiceNowPassword)} must be set."); } var environment = ServiceNowEnvironment.Community; Enum.TryParse(config.ServiceNowEnvironment, true, out environment); options.Environment = environment; Client = new ServiceNowClient( config.ServiceNowAccount, config.ServiceNowUsername, config.ServiceNowPassword, options ); }
/// <summary> /// Constructor /// </summary> /// <param name="output"></param> protected TestBase(ITestOutputHelper output) { Logger = output.BuildLogger(); Logger.LogInformation(Resources.TestStarted); TestConfig = JsonConvert.DeserializeObject <TestConfig>(File.ReadAllText("../../../appsettings.json")); RundeckClient = new RundeckClient( new RundeckClientOptions { Uri = TestConfig.Uri, ApiToken = TestConfig.Token, Logger = Logger }); }
protected TestWithOutput(ITestOutputHelper iTestOutputHelper) { ITestOutputHelper = iTestOutputHelper; Logger = iTestOutputHelper.BuildLogger(); var nowUtc = DateTimeOffset.UtcNow; StartEpoch = nowUtc.AddDays(-30).ToUnixTimeSeconds(); EndEpoch = nowUtc.ToUnixTimeSeconds(); var configuration = LoadConfiguration("appsettings.json"); var autoTaskCredentials = configuration.AutoTaskCredentials; Client = new Client( autoTaskCredentials.Username, autoTaskCredentials.Password, iTestOutputHelper.BuildLoggerFor <Client>()); AutoTaskClient = new AutoTaskClient(new AutoTaskConfiguration { Username = autoTaskCredentials.Username, Password = autoTaskCredentials.Password }); Stopwatch = Stopwatch.StartNew(); }
public PdfGeneratorTests(ITestOutputHelper output) { var services = TestHelper.CreateDIContainer(output).AddTestCache(); var config = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary <string, string> { { "pdfGenerator:url", "https://dev-pdf-generator.apps.clab.devops.gov.bc.ca/" }, { "pdfGenerator:allowInvalidServerCertificate", "true" } }).Build(); new Configuration().ConfigureServices(new EMBC.Utilities.Configuration.ConfigurationServices { Services = services, Environment = new HostingEnvironment { EnvironmentName = Environments.Development }, Logger = output.BuildLogger(), Configuration = config }); this.services = services.BuildServiceProvider(validateScopes: true); }
protected TestWithOutput(ITestOutputHelper iTestOutputHelper) { Logger = iTestOutputHelper.BuildLogger(); var testPortalConfig = new TestPortalConfig(Logger); PortalClient = testPortalConfig.PortalClient; WindowsDeviceId = testPortalConfig.WindowsDeviceId; WindowsDeviceLargeDeviceDataSourceId = testPortalConfig.WindowsDeviceLargeDeviceDataSourceId; ServiceDeviceId = testPortalConfig.ServiceDeviceId; NetflowDeviceId = testPortalConfig.NetflowDeviceId; DeviceGroupFullPath = testPortalConfig.DeviceGroupFullPath; WebsiteGroupFullPath = testPortalConfig.WebsiteGroupFullPath; SnmpDeviceId = testPortalConfig.SnmpDeviceId; AllWidgetsDashboardId = testPortalConfig.AllWidgetsDashboardId; AccountHasBillingInformation = testPortalConfig.AccountHasBillingInformation; var nowUtc = DateTime.UtcNow; StartEpoch = nowUtc.AddDays(-30).SecondsSinceTheEpoch(); EndEpoch = nowUtc.SecondsSinceTheEpoch(); Stopwatch = Stopwatch.StartNew(); }
protected TestWithOutput(ITestOutputHelper iTestOutputHelper, ConnectionMode connectionMode) { Logger = iTestOutputHelper.BuildLogger(); Config = new TestPortalConfig(Logger); switch (connectionMode) { case ConnectionMode.None: break; case ConnectionMode.Connect: Client = new Client(Config.Username, Config.Password); Client.ConnectAsync().GetAwaiter().GetResult(); break; case ConnectionMode.ConnectAndSelectDomain: Client = new Client(Config.Username, Config.Password, Config.TenantId, Config.DomainId); Client.ConnectAsync().GetAwaiter().GetResult(); break; } }
/// <summary> /// Constructs a ServiceNowClient /// </summary> /// <param name="iTestOutputHelper"></param> /// <param name="appsettingsFilename"></param> /// <param name="options"></param> protected ServiceNowTest(ITestOutputHelper iTestOutputHelper, string appsettingsFilename = "appsettings.json", Options options = null) { options = options ?? new Options(); Logger = iTestOutputHelper.BuildLogger(); options.Logger = Logger; // Locate the configuration file path at the root of the test project, relative from where these assemblies were deployed var configurationJsonFilePath = Path.Combine(Path.GetDirectoryName(typeof(ServiceNowTest).GetTypeInfo().Assembly.Location), "../../.."); var configurationRoot = new ConfigurationBuilder() .SetBasePath(configurationJsonFilePath) .AddJsonFile(appsettingsFilename, optional: false, reloadOnChange: false) .Build(); var config = configurationRoot.Get <TestConfiguration>(); if (string.IsNullOrWhiteSpace(config.ServiceNowAccount)) { throw new Exception($"{nameof(TestConfiguration)}.{nameof(TestConfiguration.ServiceNowAccount)} must be set."); } if (string.IsNullOrWhiteSpace(config.ServiceNowUsername)) { throw new Exception($"{nameof(TestConfiguration)}.{nameof(TestConfiguration.ServiceNowUsername)} must be set."); } if (string.IsNullOrWhiteSpace(config.ServiceNowPassword)) { throw new Exception($"{nameof(TestConfiguration)}.{nameof(TestConfiguration.ServiceNowPassword)} must be set."); } Client = new ServiceNowClient( config.ServiceNowAccount, config.ServiceNowUsername, config.ServiceNowPassword, options ); }
public EvaluatorTests(ITestOutputHelper output) { _logger = output.BuildLogger(); }
public ClassChangesTests(ITestOutputHelper output) { var logger = output.BuildLogger(LogLevel.Information); _calculator = ChangeCalculatorFactory.BuildCalculator(logger); }
public PropertyAccessorMatchProcessorTests(ITestOutputHelper output) { _logger = output.BuildLogger(); }
protected Test(ITestOutputHelper testOutputHelper) { Client = new CyberAlertClient(); Logger = testOutputHelper.BuildLogger(); }
public ClashParserTests(ITestOutputHelper output) { parser = new ClashParser(output.BuildLogger()); }
public MatchProcessorTests(ITestOutputHelper output) : base(output.BuildLogger(LogLevel.Debug)) { }
public SimpleTest(ITestOutputHelper outputHelper) { _outputHelper = outputHelper; _logger = outputHelper.BuildLogger(); }
public AttributeMatchProcessorTests(ITestOutputHelper output) { _output = output; _logger = output.BuildLogger(); }
public FunctionsTests(ITestOutputHelper output) { this.logger = output.BuildLogger(); }
public ReopenTests(ITestOutputHelper testOutputHelper) { _logger = testOutputHelper.BuildLogger(); }
public FieldMatchProcessorTests(ITestOutputHelper output) { _logger = output.BuildLogger(); }
protected TogglTest(ITestOutputHelper iTestOutputHelper) { Logger = iTestOutputHelper.BuildLogger(); Configuration = LoadConfiguration("appsettings.json"); TogglClient = new TogglClient(Configuration.ApiKey); }
public SurgeParserTests(ITestOutputHelper helper) { parser = new SurgeParser(helper.BuildLogger()); }
public LoggerExtensionsTests(ITestOutputHelper output) { _logger = output.BuildLogger(); }
public ChangeCalculatorTests(ITestOutputHelper output) { _logger = output.BuildLogger(); }