Exemple #1
0
        public void DehydrateSimpleResponseTest()
        {
            Test     test  = Hydrator.Hydrate(testXMLPath, TestBootup1EXMLFile);
            XElement xTest = Dehydrator.Dehydrate(test);

            Assert.IsNotNull(xTest);
        }
Exemple #2
0
        public void DehydrateNoResponseTest()
        {
            Test     test  = Hydrator.Hydrate(xmlPath, "Test 1A.xml");
            XElement xTest = Dehydrator.Dehydrate(test);

            Assert.IsNotNull(xTest);
        }
Exemple #3
0
        public void DehydrateTest()
        {
            IEnumerable <Test> tests = Hydrator.Hydrate(convertedXMLPath);
            XElement           test  = Dehydrator.Dehydrate(tests.First());

            Assert.IsNotNull(test);
        }
Exemple #4
0
        public void UUTCOCommandTest()
        {
            TestSets testCollections = Hydrator.Hydrate("CO Command Test", COCommandXML);

            ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents)));
            //ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.LoadFile(@"C:\Development\Kapsoft\True Position\Test Components\Output\Out.dll"));

            QFManager.Port.Create(PortType.Serial, "COM1");
            QFManager.Port.Receive("COM1", port_DataReceived);
            QFManager.Port.Error("COM1", port_Error);
            QFManager.Port.ReceiveTimeout("COM1", port_ReceiveTimeoutExpired);
            QFManager.Port.Open("COM1");

            Test test = testCollections["Bootup"]["1A"];

            QFManager.Test.Load(test, UUTTestMode.Direct);
            QFManager.Test.Stepping(test.Name, test_Stepping);
            QFManager.Test.TestStepped(test.Name, test_Stepped);
            QFManager.Test.Passed(test.Name, test_Passed);
            QFManager.Test.Failed(test.Name, test_Failed);

            QFManager.UUT.Load("LMU1", @"..\..\..\Documents\\UUT CO Response.xml", test, UUTTestMode.Direct);
            QFManager.UUT.Failed("LMU1", uut_Failed);
            QFManager.UUT.Passed("LMU1", uut_Passed);

            QFManager.UUT.Run("LMU1");
            QFManager.Test.Run(test.Name);

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
Exemple #5
0
        public void HydrateTest()
        {
            string   name   = "Bootup";
            TestSets actual = Hydrator.Hydrate(name, convertedXMLFilePath);

            Assert.IsNotNull(actual);
        }
Exemple #6
0
        public void UUTBootup1ETest()
        {
            TestSets testCollections = Hydrator.Hydrate("Bootup Tests", TestBootup1EXML);

            QFManager.Port.Create(PortType.Serial, "COM1");
            QFManager.Port.Receive("COM1", port_DataReceived);
            QFManager.Port.Error("COM1", port_Error);
            QFManager.Port.ReceiveTimeout("COM1", port_ReceiveTimeoutExpired);
            QFManager.Port.Open("COM1");

            Test test = testCollections["Bootup"]["1E"];

            QFManager.Test.Load(test, UUTTestMode.Direct);
            QFManager.Test.Stepping(test.Name, test_Stepping);
            QFManager.Test.TestStepped(test.Name, test_Stepped);
            QFManager.Test.Passed(test.Name, test_Passed);
            QFManager.Test.Failed(test.Name, test_Failed);
            QFManager.Test.Aborted(test.Name, test_Aborted);

            //QFManager.Test.Abort(test.Name, "Abort before we even got started.");
            //System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);

            QFManager.UUT.Load("LMU1", @"..\..\..\Documents\\UUT Bootup-1E Responses.xml", test, UUTTestMode.Direct);
            QFManager.UUT.Failed("LMU1", uut_Failed);
            QFManager.UUT.Passed("LMU1", uut_Passed);

            QFManager.UUT.Run("LMU1");
            QFManager.Test.Run(test.Name);

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);

            //System.Threading.Thread.Sleep(1000);
            //QFManager.Test.Abort(test.Name, "Because I wanted to. That's why...");
        }
Exemple #7
0
        public void TempuratureResponseTest()
        {
            XElement exerpt = XElement.Parse("<TestSets>" +
                                             "<TestSet Name=\"Bootup\">" +
                                             "<Test Type=\"Bootup\" Name=\"1A\">" +
                                             "<Step Type=\"Bootup\">" +
                                             "<Command>pro</Command>" +
                                             "<Response Delimiter=\"&#xA;\">" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'TEMPERATURES:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*recvr*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 70</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "<Expected Trim=\"true\"> Trim=\"true\"" +
                                             "<KeyExpression>value like '*bdc*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 28</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*power supply*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 35</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "</Response>" +
                                             "<Timeout>180</Timeout>" +
                                             "<BeginState>BOOT</BeginState>" +
                                             "<EndState>DSHELL</EndState>" +
                                             "<Retries>0</Retries>" +
                                             "</Step>" +
                                             "</Test>" +
                                             "</TestSet>" +
                                             "</TestSets>");

            TestSets collections = Hydrator.Hydrate("Test", exerpt);

            ResponseProcessor.Process("First Test", collections["Bootup"]["1A"].Steps[0], "TEMPERATURES: recvr 31 bdc 28 power supply 35");
        }
        static void Main(string[] args)
        {
            var hydrator = new Hydrator();

            hydrator.Configure(x =>
            {
                x.For <Person>().Property(y => y.Id).Skip();
                x.For <Person>().Property(y => y.FirstName).Is(CommonType.AmericanName);
                x.For <Person>().Property(y => y.LastName).Is(CommonType.AmericanLastName);
                x.For <Person>().Property(y => y.Weight).Use(new IntTypeConvention(99, 250));
                x.For <Person>().Property(y => y.Height).Use(new IntTypeConvention(100, 999));
            });

            var people = Enumerable.Range(1, 1000)
                         .Select(x => hydrator.Hydrate <Person>())
                         .ToList();

            IPagedList <Person> original;
            IPagedList <Person> optimized;

            using (var database = new LocalDb())
            {
                Context.Load(database.ConnectionString, people);

                Expression <Func <Context, IQueryable <Person> > > compiled = (db) => db.Persons.OrderBy(x => x.Id);
                var query = compiled.Compile();

                var stopwatch = new Stopwatch();

                stopwatch.Start();
                using (var context = new Context(database.ConnectionString))
                {
                    original = query(context).ToPagedList(1, 100);
                }
                stopwatch.Stop();
                Console.WriteLine("original : {0} ms", stopwatch.Elapsed.TotalMilliseconds);

                stopwatch.Restart();
                using (var context = new Context(database.ConnectionString))
                {
                    optimized = new EntityFrameworkPagedList <Person>(query(context), 1, 100);
                }
                stopwatch.Stop();
                Console.WriteLine("optimized : {0} ms", stopwatch.Elapsed.TotalMilliseconds);
            }

            Console.ReadLine();
        }
Exemple #9
0
        public void ActiveTestTest()
        {
            TestSets testCollections = Hydrator.Hydrate("CO Command Test", COCommandXML);

            ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents)));

            QFManager.Port.Create(PortType.Serial, "COM1");
            QFManager.Port.Receive("COM1", port_DataReceived);
            QFManager.Port.Error("COM1", port_Error);
            QFManager.Port.ReceiveTimeout("COM1", port_ReceiveTimeoutExpired);
            QFManager.Port.Open("COM1");

            Test test = testCollections["Bootup"]["1A"];

            QFManager.Test.Load(test);
            QFManager.Test.Failed(test.Name, test_Failed);
            QFManager.Test.Passed(test.Name, test_Passed);
            QFManager.Test.Run(test.Name);

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
Exemple #10
0
        public void COResponseFileTest()
        {
            TestSets testCollections = Hydrator.Hydrate("CO Command Test", COCommandXML);

            ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents))); //Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents)));

            ResponseProcessor.Process("1A", testCollections["Bootup"]["1A"].Steps[0], "ESN: " + "\n" +
                                      "GBE_CTLR:     NOT INSTALLED            " + "\n" +
                                      "GBE_LNA:      NOT INSTALLED            " + "\n" +
                                      "GBE:          NOT INSTALLED            " + "\n" +
                                      "GBE CUST ESN: NOT INSTALLED            " + "\n" +
                                      "LMU:          06162200D010082006501DA6 " + "\n" +
                                      "GPS RCVR:     06162200D010082006501DA6 " + "\n" +
                                      "RECEIVER:     06163900B0100820070403C2 " + "\n" +
                                      "BDC:          06164000C11008200704063B " + "\n" +
                                      "PSUPPLY:      06163400G0100820064300C1 " + "\n" +
                                      "CP/DSP:       06164100B1100820064700C2 " + "\n" +
                                      "DCARD:        06160301B010082006440005 " + "\n" +
                                      "EBOARD:       NOT INSTALLED            " + "\n" +
                                      "CUSTESN:      TRULMU5207872AE          " + "\n" +
                                      "TEMPERATURES: recvr 31 bdc 28 power supply 35" + "\n" +
                                      "TPESN:        06630000D010082007050130");
        }
Exemple #11
0
        public void SaveAllTest()
        {
            IEnumerable <Test> tests = Hydrator.Hydrate(convertedXMLPath);

            tests.Save(convertedXMLPath);
        }
Exemple #12
0
        public void HydrateFolderTest()
        {
            IEnumerable <Test> actual = Hydrator.Hydrate(convertedXMLPath);

            Assert.IsNotNull(actual);
        }
Exemple #13
0
        public void COResponseStepTest()
        {
            XElement exerpt = XElement.Parse("<TestSets>" +
                                             "<TestSet Name=\"Bootup\">" +
                                             "<Test Type=\"Bootup\" Name=\"1A\">" +
                                             "<Step Type=\"Bootup\">" +
                                             "<Command>pro</Command>" +
                                             "<Response Delimiter=\"&#xA;\">" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'GPS RCVR:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value lenge 24</Expression>" +
                                             "<Expression>value validesn</Expression>" +
                                             "<Expression>value not same</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage></FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'RECEIVER:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value len 24</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage></FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'BDC:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value lenge 24</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'PSUPPLY:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value lenge 24</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'TEMPERATURES:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*recvr*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 31</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*bdc*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 28</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>BDC Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*power supply*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 35</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Power supply Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'CP/DSP:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value len 24</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'DCARD:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value lenge 24</Expression>" +
                                             "<Expression>value validesn</Expression>" +
                                             "<Expression>value not same</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'EBOARD:*'</KeyExpression>" +
                                             "<Expected Trim=\"false\">" +
                                             "<Expression>value lenge 24</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'CUSTESN:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value lenge 15</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'TPESN:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<Expression>value lenge 24</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "</Response>" +
                                             "<Timeout>180</Timeout>" +
                                             "<BeginState>BOOT</BeginState>" +
                                             "<EndState>DSHELL</EndState>" +
                                             "<Retries>0</Retries>" +
                                             "</Step>" +
                                             "</Test>" +
                                             "</TestSet>" +
                                             "</TestSets>");

            TestSets collections = Hydrator.Hydrate("Test", exerpt);

            ResponseProcessor.Process("First Test", collections["Bootup"]["1A"].Steps[0], "ESN: " + "\n" +
                                      "GBE_CTLR:     NOT INSTALLED            " + "\n" +
                                      "GBE_LNA:      NOT INSTALLED            " + "\n" +
                                      "GBE:          NOT INSTALLED            " + "\n" +
                                      "GBE CUST ESN: NOT INSTALLED            " + "\n" +
                                      "GPS RCVR:     06162200D010082006501DA6 " + "\n" +
                                      "RECEIVER:     06163900B0100820070403C2 " + "\n" +
                                      "BDC:          06164000C11008200704063B " + "\n" +
                                      "PSUPPLY:      06163400G0100820064300C1 " + "\n" +
                                      "CP/DSP:       06164100B1100820064700C2 " + "\n" +
                                      "DCARD:        06160301B010082006440005 " + "\n" +
                                      "EBOARD:       NOT INSTALLED            " + "\n" +
                                      "CUSTESN:      TRULMU5207872AE          " + "\n" +
                                      "TEMPERATURES: recvr 31 bdc 28 power supply 35" + "\n" +
                                      "TPESN:        06630000D010082007050130");

            //element.Save(@"C:\Development\Kapsoft\True Position\Documents\COCommandTest.xml");
        }
Exemple #14
0
        public void SaveNoResponseTest()
        {
            Test test = Hydrator.Hydrate(xmlPath, "Test 1A.xml");

            test.Save(xmlPath, "Test 1A1.xml");
        }
Exemple #15
0
        public void SaveSimpleResponseTest()
        {
            Test test = Hydrator.Hydrate(testXMLPath, TestBootup1EXMLFile);

            test.Save(testXMLPath, TestBootup1EXMLFile + ".test");
        }
Exemple #16
0
        public void HydrateFileTest()
        {
            Test test = Hydrator.Hydrate(testXMLPath, TestBootup1EXMLFile);

            Assert.IsNotNull(test);
        }
Exemple #17
0
        static void Main(string[] args)
        {
            var hydrator = new Hydrator();

            hydrator.Configure(x =>
            {
                x.For <Person>().Property(y => y.Id).Skip();
                x.For <Person>().Property(y => y.FirstName).Is(CommonType.AmericanName);
                x.For <Person>().Property(y => y.LastName).Is(CommonType.AmericanLastName);
                x.For <Person>().Property(y => y.Weight).Use(new IntTypeConvention(99, 250));
                x.For <Person>().Property(y => y.Height).Use(new IntTypeConvention(100, 999));
            });

            var people = Enumerable.Range(1, 1000)
                         .Select(x => hydrator.Hydrate <Person>())
                         .ToList();

            IPagedList <Person> original;
            IPagedList <Person> optimized;
            IPagedList <Person> manual;
            IPagedList <Person> future;

            using (var database = new LocalDb())
            {
                var connectionString = database.ConnectionString + "MultipleActiveResultSets=True;";

                Context.Load(connectionString, people);

                var stopwatch = new Stopwatch();

                Dictionary <string, List <double> > runs = new Dictionary <string, List <double> >()
                {
                    { "original", new List <double>() },
                    { "optimized", new List <double>() },
                    { "manual", new List <double>() },
                    { "future (static)", new List <double>() }
                };

                for (int i = 0; i < 100; i++)
                {
                    using (var context = new Context(connectionString))
                    {
                        var query = context.Persons.OrderBy(x => x.Id).AsNoTracking();
                        stopwatch.Start();
                        original = query.ToPagedList(1, 100);
                        stopwatch.Stop();
                        Print("original", original, stopwatch, runs);
                    }

                    using (var context = new Context(database.ConnectionString))
                    {
                        var query = context.Persons.OrderBy(x => x.Id).AsNoTracking();
                        stopwatch.Restart();
                        optimized = new EntityFrameworkPagedList <Person>(query, 1, 100);
                        stopwatch.Stop();
                        Print("optimized", optimized, stopwatch, runs);
                    }

                    using (var context = new Context(database.ConnectionString))
                    {
                        var query = context.Persons.OrderBy(x => x.Id).AsNoTracking();
                        stopwatch.Restart();
                        manual = new StaticPagedList <Person>(query.Skip(0).Take(100).ToList(), 1, 100, query.Count());
                        stopwatch.Stop();
                        Print("manual", manual, stopwatch, runs);
                    }

                    using (var context = new Context(database.ConnectionString))
                    {
                        var query = context.Persons.OrderBy(x => x.Id).AsNoTracking();

                        var items = query.Skip(0).Take(100).Future();
                        var total = query.FutureCount();

                        stopwatch.Restart();
                        future = new StaticPagedList <Person>(items, 1, 100, total);
                        stopwatch.Stop();
                        Print("future (static)", future, stopwatch, runs);
                    }
                    if (i % 100 == 0)
                    {
                        Console.WriteLine("{0} -----", i);
                    }
                }

                foreach (var run in runs)
                {
                    Console.WriteLine("{0} average : {1} ms", run.Key, run.Value.Average());
                }
                Console.WriteLine("-----");
            }

            Console.ReadLine();
        }