public void Primitive_StringNull()
        {
            var target = RunnerFactory.Create();
            var result = target.Query(new TestQuery <string>("SELECT NULL AS TestString;"));

            result.Should().BeNull();
        }
        public void Primitive_int()
        {
            var target = RunnerFactory.Create();
            var result = target.Query(new TestQuery <int>("SELECT 5 AS TestInt;"));

            result.Should().Be(5);
        }
Esempio n. 3
0
        public void Map_int_ByteBasedEnum()
        {
            var runner = RunnerFactory.Create();
            var result = runner.Query <ByteBasedEnum>("SELECT 1").Single();

            result.Should().Be(ByteBasedEnum.ValueB);
        }
        public void Primitive_String()
        {
            var target = RunnerFactory.Create();
            var result = target.Query(new TestQuery <string>("SELECT 'TEST' AS TestString;"));

            result.Should().Be("TEST");
        }
Esempio n. 5
0
        public void TestProductGroup()
        {
            var runner = RunnerFactory.Create();
            var result = runner.Query(new GetProductGroupQuery());

            result.Products.Count.Should().Be(0);
        }
Esempio n. 6
0
        public static int Main(string[] args)
        {
            var testRunnerAssembly = typeof(Program).GetTypeInfo().Assembly;

            Console.WriteLine(testRunnerAssembly.GetPrintInfo());

            var argumentParser = new ArgumentParser();

            try
            {
                var options = argumentParser.Parse(args);

                var channelFactory = new ChannelFactory(options);

                var runnerFactory = new RunnerFactory(new ProxyFactory(), channelFactory);

                var runner = runnerFactory.Create(options);

                runner.Start();

                return(ReturnCodes.Ok);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);

                return(ReturnCodes.Error);
            }
        }
Esempio n. 7
0
        public void Map_CaseInsensitiveString()
        {
            var runner = RunnerFactory.Create();
            var result = runner.Query <IntBasedEnum>("SELECT 'valueb'").Single();

            result.Should().Be(IntBasedEnum.ValueB);
        }
Esempio n. 8
0
        public void RunningACoroutineFromEverywhereShouldPropagateExceptions()
        {
            var coroutine = new ExeCoRoutine();

            coroutine.Enumerable = ExecuteAndThrowAfterInitialization().GetEnumerator();

            var target = new CoroutinesManager();

            target.TestInitialize();
            RunnerFactory.Initialize(() => target);

            target.Start();
            var parent = Task.Run(() =>
            {
                var task = CoroutineResult.WaitForCoroutine(coroutine);
                task.Wait();
            });

            Exception expected = null;

            try
            {
                parent.Wait();
            }
            catch (Exception ex)
            {
                expected = ex;
            }
            target.Stop();

            Assert.IsNotNull(expected);
        }
Esempio n. 9
0
        public void GetOutputParameter_ConvertType()
        {
            var target = RunnerFactory.Create();
            var result = target.Execute(new TestCommand_OutputParameterConverted());

            result.Should().Be("5");
        }
Esempio n. 10
0
        public void GetOutputParameter_Test()
        {
            var target = RunnerFactory.Create();
            var result = target.Execute(new TestCommand_OutputParameter());

            result.Should().Be("TEST");
        }
Esempio n. 11
0
        private static void RunTraining(bool requireInit)
        {
            WriteLine("CATS CLASSIFICATION");
            WriteLine();

            Action <string, Action> runProcessAndWriteInConsole =
                (processName, action) =>
            {
                WriteLine($"{processName}...");
                action();
                WriteLine();
            };

            if (requireInit)
            {
                runProcessAndWriteInConsole("Initialization",
                                            () => Init());
            }

            var runner = RunnerFactory.GetRunnerForCats();

            runner.Mount(FinalizePath(NEW_MODEL_FILE));

            runner.TrainingIterationPerformed += TrainingIterationPerformed;
            runner.TrainingFinished           += TrainingFinished;
            runner.TestingFinished            += TestingFinished;

            runProcessAndWriteInConsole("Training", () => runner.Train(FinalizePath(TRAIN_DATASET_FILE)));
            runProcessAndWriteInConsole("Testing", () => runner.Test(FinalizePath(TEST_DATASET_FILE)));

            WriteLine("Press any key to exit...");
            ReadLine();
        }
        public void TestCreate()
        {
            Mock <IXunitAssemblyRunnerFactory> moq;
            RunnerFactory sut;
            Runner        actual;

            moq    = new Mock <IXunitAssemblyRunnerFactory>();
            sut    = new RunnerFactory(moq.Object);
            actual = sut.Create("abc.dll");

#if NET35
            Assert.Equal(1, actual.AssemblyLocations.Count);
#else
            Assert.Single(actual.AssemblyLocations);
#endif
            Assert.Contains("abc.dll", actual.AssemblyLocations);

            moq    = new Mock <IXunitAssemblyRunnerFactory>();
            sut    = new RunnerFactory(moq.Object);
            actual = sut.Create(new string[] { "abc.dll", "xyz.dll" });

            Assert.Equal(2, actual.AssemblyLocations.Count);
            Assert.Contains("abc.dll", actual.AssemblyLocations);
            Assert.Contains("xyz.dll", actual.AssemblyLocations);
        }
        public void FactoryMethod_ReturnsNonNull()
        {
            var target = RunnerFactory.Create();
            var result = target.Query(new FactoryMethodReturnsNonNullQuery());

            result.Id.Should().Be(1);
            result.Name.Should().Be("TEST");
        }
        public void DoNotTreatPostgresColumnAsUnnamed()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <TestObjectUnnamedValues>("SELECT 5 AS [?column?];");

            result.Count.Should().Be(1);
            result[0].UnnamedValues.Count.Should().Be(0);
        }
        public void DeepMapping_Dictionary()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <Test8>("SELECT 1 AS A_B_C_Values_Test;").First();

            result.Should().BeOfType <Test8>();
            result.A.B.C.Values["test"].Should().Be(1);
        }
Esempio n. 16
0
        public Check(RunnerFactory runnerFactory)
            : base()
        {
            this.runnerFactory = runnerFactory;

            IsCommand("check", "Checks that a host can be controlled.");
            HasOption<RunnerType>("r|runnertype=", "Use a specific runner type: psexec | Powershell", r => runnerTypes.Add(r));
        }
        public void TestQuery_ObjectWithChild()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <TestObject_WithChild>("SELECT 5 AS Id, 'TEST' AS Child_Name;").First();

            result.Id.Should().Be(5);
            result.Child.Name.Should().Be("TEST");
        }
        public void TestQuery_ObjectWithChildNull()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <TestObject_WithChildObject>("SELECT 5 AS Id;").First();

            result.Id.Should().Be(5);
            result.Value.Should().BeNull();
        }
Esempio n. 19
0
        public void TestQuery_MapStringToDateTimeList()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <List <DateTime> >("SELECT '2018-12-11 17:01:02'").First();

            result.Count.Should().Be(1);
            result[0].Should().Be(new DateTime(2018, 12, 11, 17, 1, 2));
        }
        public void TestQuery_NestedChildrenCustomSeparator()
        {
            var target = RunnerFactory.Create();
            var query  = SqlQuery.FromString <TestObject_WithNestedChildren>("SELECT 'TEST' AS AXBXValue", setup: c => c.UseChildSeparator("X"));
            var result = target.Query(query).Single();

            result?.A?.B?.Value.Should().Be("TEST");
        }
Esempio n. 21
0
        static void Main(string[] args)
        {
            var runner = RunnerFactory.Create("server=localhost;Integrated Security=SSPI;");
            var result = runner.Query(new TestQuery());
            var json   = JsonConvert.SerializeObject(result, Formatting.Indented);

            System.Console.WriteLine(json);
        }
        public void Map_CustomCollectionType()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <TestCollectionType>("SELECT 'A', 'B', 'C'").First().ToList();

            result[0].Should().Be("A");
            result[1].Should().Be("B");
            result[2].Should().Be("C");
        }
Esempio n. 23
0
        public void Map_Tuple_CustomObject1()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <Tuple <int, TestObject1> >("SELECT 5 AS Id, 'TEST1' AS A, 'TEST2' AS B").First();

            result.Item1.Should().Be(5);
            result.Item2.A.Should().Be("TEST1");
            result.Item2.B.Should().Be("TEST2");
        }
Esempio n. 24
0
        public void Map_TupleTooFewColumns()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <Tuple <int, string, int?> >("SELECT 5, 'TEST';").First();

            result.Item1.Should().Be(5);
            result.Item2.Should().Be("TEST");
            result.Item3.Should().Be(null);
        }
Esempio n. 25
0
        public void Map_Tuple()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <Tuple <int, string, bool> >("SELECT 5, 'TEST', 1;").First();

            result.Item1.Should().Be(5);
            result.Item2.Should().Be("TEST");
            result.Item3.Should().Be(true);
        }
        public void TestQuery_ObjectPropertySingleValue()
        {
            var target = RunnerFactory.Create();
            var result = target.Query <TestObject_WithChildObject>("SELECT 6 AS Id, 'A' AS Value").First();

            result.Id.Should().Be(6);
            result.Value.Should().BeOfType <string>();
            (result.Value as string).Should().Be("A");
        }
        public void TestQuery_ObjectWithChildCustomSeparator()
        {
            var target = RunnerFactory.Create();
            var query  = SqlQuery.FromString <TestObject_WithChild>("SELECT 5 AS Id, 'TEST' AS ChildXName;", setup: c => c.UseChildSeparator("X"));
            var result = target.Query(query).First();

            result.Id.Should().Be(5);
            result.Child.Name.Should().Be("TEST");
        }
Esempio n. 28
0
        public void Map_ConstructorWithUnusedParameter()
        {
            var target = RunnerFactory.Create();

            var result = target.Query(new TestQuerySpecifySecondConstructor()).First();

            result.Id.Should().Be(5);
            result.DoesNotExist.Should().BeNull();
        }
Esempio n. 29
0
        public void SetUp()
        {
            RunnerFactory = A.Fake <IBoostTestRunnerFactory>();
            A.CallTo(() => RunnerFactory.GetRunner(A <string> ._, A <BoostTestRunnerFactoryOptions> ._)).Returns(A.Fake <IBoostTestRunner>());

            Settings = new BoostTestAdapterSettings();

            ArgsBuilder = (string source, BoostTestAdapterSettings settings) => { return(new BoostTestRunnerCommandLineArgs()); };
        }
Esempio n. 30
0
        public void TestQuery_UnboxProperties()
        {
            var target = RunnerFactory.Create();
            var result = target.Query(new TestQuery_Unbox());

            result.TestInt.Should().Be(5);
            result.TestString.Should().Be("6");
            result.TestBool.Should().Be(true);
        }
Esempio n. 31
0
        public void TestQuery1_ConstructorParams_Test()
        {
            var target = RunnerFactory.Create();
            var result = target.Query(new TestQuery1());

            result.TestInt.Should().Be(5);
            result.TestString.Should().Be("TEST");
            result.TestBool.Should().Be(true);
        }