public async Task can_assign_multiple_aws_ips_testruns_that_dont_already_have_agent_ip()
 {
     var testConfiguration = new TestConfiguration(5, 10, 5, "BbcGetRequest", "PerformanceDsl.Tests.Tests");
     var testRun = new TestRun
     {
         DllThatContainsTestsPath = "C:\\Agent\\Tests\\PerformanceDsl.Tests.dll",
         TestRunIdentifier = Guid.NewGuid()
     };
     testRun.TestConfigurations.Add(testConfiguration);
     var test = new Test
     {
         Agent = null,
         TestRun = testRun
     };
     var testSuite = new TestSuite();
     testSuite.Tests.Add(test);
     test = new Test
     {
         Agent = null,
         TestRun = testRun
     };
     testSuite.Tests.Add(test);
     test = new Test
     {
         Agent = null,
         TestRun = testRun
     };
     testSuite.Tests.Add(test);
     var performanceServer = new PerformanceServer();
     await performanceServer.BeginTestRun(testSuite);
 }
        public TestRunner(ILogger<TestRunner> logger, TestConfiguration testOptions,
            IModifiedCodeTestsFinder testsFinder, IDnxTestRunner dnxTestRunner)
        {
            _logger = logger;
            _testsFinder = testsFinder;
            _dnxTestRunner = dnxTestRunner;

            _testConfiguration = testOptions;
            _lastRunTime = DateTime.UtcNow.AddYears(-1000);
        }
        public void testFillConfiguration()
        {
            TestConfiguration testConfig = new TestConfiguration();
            // There is no "Foo" property in the config bean. We want to ensure
            // that TestHelpers.FillConfiguration() does not fail for unknown properties.
            IDictionary<string, object> configData = new Dictionary<string, object>();
            configData["Host"] = "example.com";
            configData["Port"] = 1234;
            configData["Foo"] = "bar";
            TestHelpers.FillConfiguration(testConfig, configData);

            Assert.AreEqual("example.com", testConfig.Host);
            Assert.AreEqual(1234, testConfig.Port);
        }
Example #4
0
        protected override void Configure(TestConfiguration config, Random random)
        {
            base.Configure(config, random);

            var tracer = new TraceAppender();
            var hierarchy = (Hierarchy)LogManager.GetRepository();

            var patternLayout = new PatternLayout { ConversionPattern = "%property{log4net:HostName}" };
            tracer.Layout = patternLayout;

            hierarchy.Root.AddAppender(tracer);
            hierarchy.Configured = true;

            Log = LogManager.GetLogger("");
        }
        public void WriteFileToDisk()
        {
            var config = new TestConfiguration();
            var fileName = "someOutput.txt";
            var filePath = config.GetDataPath(fileName);

            System.IO.File.Delete(filePath);
            Assert.That( System.IO.File.Exists(filePath), Is.False );

            var writer = new FileWriter( fileName, config );
            writer.PutChar('X');
            writer.PutChar('Y');
            writer.PutChar('Z');
            Assert.That( System.IO.File.Exists(filePath), Is.True );
            Assert.That( System.IO.File.ReadAllText(filePath), Is.EqualTo("XYZ") );
        }
        public void CanHandleErrorResponses()
        {
            var bogusConfiguration = new TestConfiguration
            {
                AcquirerUrl = "https://www.ideal-simulator.nl:443/professional/",
                AcceptantCertificate = PrivateCertificate,
                AcquirerCertificate = PublicCertificate,
                MerchantSubId = 0,
                MerchantId = "000000000" // faulty merchant id
            };

            Assert.Throws<iDealException>(delegate
            {
                var directoryResponse = new iDealService(bogusConfiguration).SendDirectoryRequest();
            });
        }
Example #7
0
 public virtual void LaunchApplication()
 {
     try
     {
         Keyboard = Keyboard.Instance;
         TestConfiguration = testMode.GetConfiguration(CommandLineArguments, this);
         Application = TestConfiguration.Launch();
         BaseTestFixtureSetup();
         TestFixtureSetUp();
     }
     catch (Exception e)
     {
         logger.Error("Failed to launch application", e);
         TextFixtureTearDown();
         throw;
     }
 }
Example #8
0
 public virtual void LaunchApplication()
 {
     try
     {
         keyboard = Keyboard.Instance;
         testConfiguration = testMode.GetConfiguration(CommandLineArguments, this);
         application = testConfiguration.Launch();
         BaseTestFixtureSetup();
         TestFixtureSetUp();
     }
     catch (Exception e)
     {
         WhiteLogger.Instance.Error(e);
         TextFixtureTearDown();
         throw;
     }
 }
 public void can_run_tests()
 {
     var testConfiguration = new TestConfiguration(5, 10, 5, "BbcGetRequest", "PerformanceDsl.Tests.Tests");
     var testRun = new TestRun
     {
         DllThatContainsTestsPath = "C:\\Agent\\Tests\\PerformanceDsl.Tests.dll",
         TestRunIdentifier = Guid.NewGuid()
     };
     testRun.TestConfigurations.Add(testConfiguration);
     var testRunner = new TestRunner();
     XmlConfigurator.Configure();
     Task task = testRunner.Begin(testRun);
     task.ContinueWith(x =>
     {
         Console.WriteLine(x.Status.ToString());
         Console.WriteLine("end");
     });
     task.Wait();
 }
 public async Task can_send_test_to_agent_where_test_has_no_agent()
 {
     var testConfiguration = new TestConfiguration(5, 10, 5, "BbcGetRequest", "PerformanceDsl.Tests.Tests");
     var testRun = new TestRun
     {
         DllThatContainsTestsPath = "C:\\Agent\\Tests\\PerformanceDsl.Tests.dll",
         TestRunIdentifier = Guid.NewGuid()
     };
     testRun.TestConfigurations.Add(testConfiguration);
     var test = new Test
     {
         Agent = null,
         TestRun = testRun
     };
     var testSuite = new TestSuite();
     testSuite.Tests.Add(test);
     var performanceServer = new PerformanceServer();
     await performanceServer.BeginTestRun(testSuite);
 }
Example #11
0
        public async Task can_post_to_agent()
        {
            var testConfiguration = new TestConfiguration(5, 10, 5, "BbcGetRequest", "PerformanceDsl.Tests.Tests");
            var testRun = new TestRun
            {
                DllThatContainsTestsPath = "C:\\Agent\\Tests\\PerformanceDsl.Tests.dll",
                TestRunIdentifier = Guid.NewGuid()
            };
            testRun.TestConfigurations.Add(testConfiguration);
            string serialisedTestRun = JsonConvert.SerializeObject(testRun);

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var content = new StringContent(serialisedTestRun);
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                HttpResponseMessage result =
                    await httpClient.PostAsync("http://localhost:9999", content);
                result.EnsureSuccessStatusCode();
            }
        }
 public async Task can_upload_dll_to_agent()
 {
     var testConfiguration = new TestConfiguration(5, 10, 5, "BbcGetRequest", "PerformanceDsl.Tests.Tests");
     var testRun = new TestRun
     {
         DllThatContainsTestsPath = "C:\\Agent\\Tests\\PerformanceDsl.Tests.dll",
         TestRunIdentifier = Guid.NewGuid()
     };
     testRun.TestConfigurations.Add(testConfiguration);
     var test = new Test
     {
         Agent = "localhost",
         TestRun = testRun
     };
     var testSuite = new TestSuite();
     testSuite.Tests.Add(test);
     testSuite.DllsThatNeedUploadingToAgent.Add(
         @"C:\git\PerformanceDsl\PerformanceDsl.Tests\PerformanceDsl.Tests\bin\Debug\PerformanceDsl.Tests.dll");
     var performanceServer = new PerformanceServer();
     await performanceServer.BeginTestRun(testSuite);
 }
Example #13
0
		public CloseNotifyTest (TestConfiguration config, ClientAndServerFactory factory)
			: base (config, factory)
		{
		}
Example #14
0
 protected override void Configure(TestConfiguration config, Random random)
 {
     base.Configure(config, random);
 }
Example #15
0
        protected override void Configure(TestConfiguration config, Random random)
        {
            base.Configure(config, random);

            var c = new NLog.Config.LoggingConfiguration();
            var traceTarget = new NLog.Targets.TraceTarget();
            traceTarget.Layout = "${message}";
            c.AddTarget("trace", traceTarget);

            var rule1 = new NLog.Config.LoggingRule("*", NLog.LogLevel.Error, traceTarget);
            c.LoggingRules.Add(rule1);

            NLog.LogManager.Configuration = c;

            Logger =  NLog.LogManager.GetCurrentClassLogger();
        }
Example #16
0
 public virtual void TextFixtureTearDown()
 {
     BaseTestFixtureTearDown();
     Application = null;
     TestConfiguration = null;
 }
 public void HasTestConfigFile()
 {
     var config = new TestConfiguration();
     var testFilePath = config.GetDataPath("someInput.txt");
     Assert.That( System.IO.File.Exists(testFilePath), Is.True );
 }
 public void FixtureSetup()
 {
     TestMode testMode = TestMode.Create(Environment.CommandLine);
     configuration = testMode.GetConfiguration(string.Empty, this);
 }
        private static void LoadTestConfiguration()
        {
            Log.Info("Searching beazleyConfiguration.config...");
            string configFilePath = FindConfigFile(AppDomain.CurrentDomain.BaseDirectory);

            Log.Info(string.IsNullOrWhiteSpace(configFilePath)
                                ? "Not Found."
                                : string.Format("Found: {0}", configFilePath));

            _testConfiguration = new TestConfiguration(configFilePath);

            _log4NetConfigFilePath = BuildFilePath(GetParentFolderPath(configFilePath), ConfigurationManager.AppSettings["Log4NetConfigurationFilePath"]);
            Log.Info(string.Format("log4net combined path = {0}", _log4NetConfigFilePath));
        }
		public SimpleInstrumentationTest (TestConfiguration config, ClientAndServerFactory factory)
			: base (config, factory)
		{
		}
        public static TestConfiguration Configuration()
        {
            if (configuration == null || AdditionalConfiguration != null)
            {
                if (configurationBuilder == null)
                {
                    configurationBuilder = new ConfigurationBuilder()
                        .AddJsonFile("testconfig.json", optional: true);
                }

                AdditionalConfiguration?.Invoke(configurationBuilder);
                AdditionalConfiguration = null;

                configuration = TestConfiguration.With(configurationBuilder.Build());
                generalConfiguration = null;

                PrepareLicensing();
            }

            return configuration;
        }
 private static void Reset()
 {
     initialiazed = false;
     configurationBuilder = null;
     configuration = null;
     environment = null;
     startupType = null;
     serviceProvider = null;
     routingServiceProvider = null;
     router = null;
     AdditionalServices = null;
     AdditionalApplicationConfiguration = null;
     AdditionalRouting = null;
     TestAssembly = null;
     TestServiceProvider.Current = null;
     TestServiceProvider.ClearServiceLifetimes();
     DefaultRegistrationPlugins.Clear();
     ServiceRegistrationPlugins.Clear();
     RoutingServiceRegistrationPlugins.Clear();
     InitializationPlugins.Clear();
     LicenseValidator.ClearLicenseDetails();
 }