Exemplo n.º 1
0
 public void Setup()
 {
     DbConnectionFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
     TestHelper          = new TestHelper();
     TestHelper.SetupTestDb(DbConnectionFactory);
     Service = new PlayerService(DbConnectionFactory);
 }
Exemplo n.º 2
0
    public void ExecuteCodeFromLoadedMods()
    {
        var loadedMods = _loader.Manager.GetLoadedMods();

        foreach (var mod in loadedMods)
        {
            var iMod = mod.Mod;

            // Tests may include mods without code.
            if (iMod != null)
            {
                ITestHelper sayHello = iMod as ITestHelper;
                if (sayHello == null)
                {
                    Assert.True(false, "Failed to cast Test Mod.");
                }

                bool isKnownConfig = sayHello.MyId == _testEnvironmoent.TestModConfigA.ModId ||
                                     sayHello.MyId == _testEnvironmoent.TestModConfigB.ModId;

                // TestMod C is unloaded, do not check for it.
                Assert.True(isKnownConfig);
            }
        }
    }
Exemplo n.º 3
0
 public static void Init(ICameraPageHelper cameraPageHelper,
                         IFileHelper fileHelper,
                         StyleHelper styleHelper,
                         IFacebookApiClient facebookApiClient,
                         IPDFHelper pdfHelper,
                         IEMailHelper eMailHelper,
                         ITestHelper testHelper)
 {
     if (!_initialized)
     {
         _initialized      = true;
         CameraPageHelper  = cameraPageHelper;
         FileHelper        = fileHelper;
         StyleHelper       = styleHelper;
         FacebookApiClient = facebookApiClient;
         PDFHelper         = pdfHelper;
         EMailHelper       = eMailHelper;
         TestHelper        = testHelper;
     }
 }
        public void startTest(FitsMistakesTest test, ITestHelper helper)
        {
            button1.Hide();
            button3.Hide();

            if (currentTest != null)
            {
                currentTest.OnTestCompleted    -= currentTest_OnTestCompleted;
                currentTest.OnTestValueUpdated -= currentTest_OnTestValueUpdated;
                currentTest.OnTryFailed        -= currentTest_OnTryFailed;
            }

            this.Text = helper.TestName;

            currentTest   = test;
            currentHelper = helper;

            currentTest.OnTestCompleted    += currentTest_OnTestCompleted;
            currentTest.OnTestValueUpdated += currentTest_OnTestValueUpdated;
            currentTest.OnTryFailed        += currentTest_OnTryFailed;
        }
        public void startTest(FitsMistakesTest test, ITestHelper helper)
        {
            button1.Hide();
            button3.Hide();

            if (currentTest != null)
            {
                currentTest.OnTestCompleted -= currentTest_OnTestCompleted;
                currentTest.OnTestValueUpdated -= currentTest_OnTestValueUpdated;
                currentTest.OnTryFailed -= currentTest_OnTryFailed;
            }

            this.Text = helper.TestName;

            currentTest = test;
            currentHelper = helper;
            
            currentTest.OnTestCompleted += currentTest_OnTestCompleted;
            currentTest.OnTestValueUpdated += currentTest_OnTestValueUpdated;
            currentTest.OnTryFailed += currentTest_OnTryFailed;
        }
Exemplo n.º 6
0
 public static ITestServiceBuilder <TService, TService> GetServiceBuilder <TService>(this ITestHelper helper)
 {
     return(helper.GetServiceBuilder <TService, TService>());
 }
Exemplo n.º 7
0
        public static int Main(string[] args)
        {
            //Ensure we definitely remove that plugin, even if we crash
            AppDomain.CurrentDomain.ProcessExit        += CurrentDomain_ProcessExit;
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Console.CancelKeyPress += CancelHandler;

            var app = new CommandLineApplication
            {
                Name        = "KongConfigurationValidation",
                Description = "Kong configuration validation."
            };

            app.HelpOption("-?|-h|--help");

            var kongHostOption = app.Option("-H|--host <KongHostname>",
                                            "Specify folder containing tests",
                                            CommandOptionType.SingleValue);

            var testsFolderOption = app.Option("-t|--testsFolder <testsFolder>",
                                               "Specify folder containing tests",
                                               CommandOptionType.SingleValue);

            var portOption = app.Option("-p|--port <HttpLogPort>",
                                        "Specify local logging listening port",
                                        CommandOptionType.SingleValue);

            app.OnExecute(async() =>
            {
                var services    = new ServiceCollection();
                var testTracker = new TestTracker();
                var startup     = new Startup(testTracker);
                startup.ConfigureServices(services);
                var serviceProvider = services.BuildServiceProvider();

                _testHelper      = serviceProvider.GetService <ITestHelper>();
                _kongAdminClient = serviceProvider.GetService <KongAdminClient>();

                var configuration = serviceProvider.GetService <IOptions <Settings> >().Value;

                if (kongHostOption.HasValue())
                {
                    configuration.KongHost = kongHostOption.Value();
                }
                else if (string.IsNullOrWhiteSpace(configuration.KongHost))
                {
                    throw new Exception("Kong hostname is not specified.");
                }

                if (portOption.HasValue())
                {
                    configuration.HttpLogPort = int.Parse(portOption.Value());
                }

                if (testsFolderOption.HasValue())
                {
                    configuration.TestsFolder = testsFolderOption.Value();
                }

                //Setup HTTP Logging Plugin
                var localIp      = GetMostLikelyIpAddress().ToString();
                var httpEndpoint = $"http://{localIp}:{configuration.HttpLogPort}";
                Log.Information($"Adding HTTP Logging Plugin with url: {httpEndpoint}");
                _httpLogPlugin = CreateHttpLogPlugin(httpEndpoint);
                await _kongAdminClient.UpsertPlugin(_httpLogPlugin);

                await Task.Delay(5000);

                //Start Logging WebServer
                BuildWebHost(args, testTracker, configuration.HttpLogPort).Start();
                await WaitForWebServer(configuration.HttpLogPort);

                _testHelper.PopulateTests();
                await _testHelper.RunTests();
                await _testHelper.Validate();
#if DEBUG
                Console.WriteLine("Press any key to continue");
                Console.ReadKey();
#endif
                return(0);
            });

            return(app.Execute(args));
        }
Exemplo n.º 8
0
 public LoggingController(ITestHelper testHelper)
 {
     _testHelper = testHelper;
 }
 public UnitTest(ITestHelper ithPara)
 {
     ith = ithPara;
 }
Exemplo n.º 10
0
 public TestController(ITestHelper testHelper)
 {
     _testHelper = testHelper;
 }
Exemplo n.º 11
0
 public static string Get(this ITestHelper html, string arg)
 {
     return(TestProvider.Get(arg));
 }