Beispiel #1
0
        /// <summary>
        /// Initializes storage connection to use
        /// </summary>
        /// <param name="connectionType">Specify if Sql or Textfile connection</param>
        public static void IntializeConnection(ConnectionType connectionType)
        {
            switch (connectionType)
            {
            case ConnectionType.Sql:
                SqlConnector sql = new SqlConnector();
                Connection = sql;
                break;

            case ConnectionType.Textfile:
                TextConnector text = new TextConnector();
                Connection = text;
                break;

            default:
                break;
            }
            //if (connectionType == ConnectionType.Sql)
            //{
            //
            //    SqlConnector sql = new SqlConnector();
            //    Connections.Add(sql);
            //}
            //elseif (connectionType == ConnectionType.Textfile)
            //{
            //
            //    TextConnector text = new TextConnector();
            //    Connections.Add(text);
            //}
        }
        public void ConnectPageModelsCount()
        {
            // constants
            const string TestKey = "MODELS-60727";

            // setup
            var configuration = new RhinoConfiguration
            {
                TestsRepository  = GetSpecsByStub("ModelsNoDataSource"),
                Models           = new[] { RhinoModelStub.InputsModel, RhinoModelStub.TablesModel },
                DriverParameters = new[]
                {
                    ChromeDriver
                }
            };

            // execute
            var actual = new TextConnector(configuration, Utilities.Types)
                         .ProviderManager
                         .TestRun
                         .TestCases
                         .First(i => i.Key == TestKey)
                         .ModelEntries
                         .Count();

            // assert
            Assert.AreEqual(expected: 3, actual);
        }
        public void ConnectDataSourceCountFromFile()
        {
            // constants
            const string TestKey = "DEMO-60727";

            // setup
            var configuration = new RhinoConfiguration
            {
                TestsRepository  = new[] { "FullSpecJson.txt" },
                Models           = new[] { RhinoModelStub.InputsModel, RhinoModelStub.TablesModel },
                DriverParameters = new[]
                {
                    ChromeDriver
                }
            };

            // execute
            var actual = new TextConnector(configuration, Utilities.Types)
                         .ProviderManager
                         .TestRun
                         .TestCases
                         .Count(i => i.Key == TestKey);

            // assert
            Assert.AreEqual(expected: 3, actual);
        }
Beispiel #4
0
 public SpringViewer()
 {
     InitializeComponent();
     allSprings = TextConnector.Spring_GetAll();
     UpdateData();
     WireUpLists();
 }
        public void ConnectDataSourceContentFromFiles(int iteration, string firstName, string lastName)
        {
            // constants
            const string TestKey = "DEMO-60727";

            // setup
            var configuration = new RhinoConfiguration
            {
                TestsRepository  = new[] { "FullSpecJson.txt" },
                Models           = new[] { "InputsModel.txt", "TablesModel.txt" },
                DriverParameters = new[]
                {
                    ChromeDriver
                }
            };

            // execute
            var actual = new TextConnector(configuration, Utilities.Types)
                         .ProviderManager
                         .TestRun
                         .TestCases
                         .Where(i => i.Key == TestKey)
                         .ElementAt(iteration);
            var asString = JsonConvert.SerializeObject(actual);

            // assert
            Assert.IsTrue(asString.Contains(firstName));
            Assert.IsTrue(asString.Contains(lastName));
        }
Beispiel #6
0
        public static void InitializeConnections(DatabaseType db)
        {
            switch (db)
            {
            case DatabaseType.Sql:
                break;

            case DatabaseType.TextFile:
                break;

            default:
                break;
            }

            if (db == DatabaseType.Sql)
            {
                // Set up SQL Connector properly
                SqlConnector sql = new SqlConnector();
                Connection = sql;
            }

            else if (db == DatabaseType.TextFile)
            {
                // Create the Text Connection
                TextConnector text = new TextConnector();
                Connection = text;
            }
        }
Beispiel #7
0
        public static List <PartSetModel> ConvertTextToPartSet(this List <string> lines)
        {
            //Id|^|Name|^|SleeveId|^|BearingId|^|CounterSleeveId;

            List <PartSetModel> output = new List <PartSetModel>();
            PartSetModel        curr   = new PartSetModel();

            List <SleeveModel>        sleeves        = TextConnector.Sleeve_GetAll();
            List <BearingModel>       bearings       = TextConnector.Bearing_GetAll();
            List <CounterSleeveModel> counterSleeves = TextConnector.CounterSleeve_GetAll();

            foreach (string line in lines)
            {
                string[] cols = line.Split(new string[] { "|^|" }, StringSplitOptions.None);
                curr.Id            = int.Parse(cols[0]);
                curr.Name          = cols[1];
                curr.Sleeve        = sleeves.Where(x => x.Id == int.Parse(cols[2])).First();
                curr.Bearing       = bearings.Where(x => x.Id == int.Parse(cols[3])).First();
                curr.CounterSleeve = counterSleeves.Where(x => x.Id == int.Parse(cols[4])).First();

                output.Add(curr);
                curr = new PartSetModel();
            }

            return(output);
        }
Beispiel #8
0
        public static List <CalculationsModel> ConvertTextToCalculation(this List <string> lines)
        {
            //Id|^|Name|^|CompressorId|^|PointId\\\\PointId\\\\PointId|^|AllowedSpringNumber;

            List <CalculationsModel> output = new List <CalculationsModel>();
            CalculationsModel        curr   = new CalculationsModel();

            List <FixationPointModel> fixationPoints = TextConnector.FixationPoint_GetAll();
            List <CompressorModel>    compressors    = TextConnector.Compressor_GetAll();

            foreach (string line in lines)
            {
                string[] cols = line.Split(new string[] { "|^|" }, StringSplitOptions.None);
                curr.Id         = int.Parse(cols[0]);
                curr.Name       = cols[1];
                curr.Compressor = compressors.Where(x => x.Id == int.Parse(cols[2])).First();

                string[] colsPoint = cols[3].Split(new string[] { "," }, StringSplitOptions.None);
                foreach (string point in colsPoint)
                {
                    curr.Points.Add(fixationPoints.Where(x => x.Id == int.Parse(point)).ToList().First());
                }

                curr.AllowedSpringNumber = int.Parse(cols[4]);

                output.Add(curr);
                curr = new CalculationsModel();
            }

            return(output);
        }
Beispiel #9
0
        public static List <FixationPointModel> ConvertTextToFixationPoint(this List <string> lines)
        {
            //Id|^|Chosen|^|UpperSpringBool|^|LowerSpringBool|^|XPosition|^|YPosition|^|PartSetModelId";

            List <FixationPointModel> output      = new List <FixationPointModel>();
            FixationPointModel        curr        = new FixationPointModel();
            List <PartSetModel>       allPartSets = TextConnector.PartSet_GetAll();

            foreach (string line in lines)
            {
                string[] cols = line.Split(new string[] { "|^|" }, StringSplitOptions.None);
                curr.Id              = int.Parse(cols[0]);
                curr.Chosen          = Boolean.Parse(cols[1]);
                curr.UpperSpringBool = Boolean.Parse(cols[2]);
                curr.LowerSpringBool = Boolean.Parse(cols[3]);
                curr.XPosition       = double.Parse(cols[4]);
                curr.YPosition       = double.Parse(cols[5]);
                curr.Parts           = allPartSets.Where(x => x.Id == int.Parse(cols[6])).First();

                output.Add(curr);
                curr = new FixationPointModel();
            }

            return(output);
        }
        public static void PrepareCalculationsSet(this CalculationsModel model, List <SolutionModel> solutions)
        {
            CalculationsModel  calculation = model;
            List <SpringModel> allSprings  = TextConnector.Spring_GetAll();

            List <List <SpringModel> > allSetups = new List <List <SpringModel> >();

            allSetups = CreateAllCombinations(calculation.AllowedSpringNumber, allSprings, new List <SpringModel>());

            int springNumber = calculation.CountSpringNumber();
            List <List <SpringModel> > allCombinations = new List <List <SpringModel> >();

            foreach (List <SpringModel> setup in allSetups)
            {
                allCombinations.AddRange(CreateAllCombinations(springNumber, setup, new List <SpringModel>()));
            }

            //List<SolutionModel> solutions = new List<SolutionModel>();

            foreach (List <SpringModel> springSetup in allCombinations)
            {
                solutions.Add(new SolutionModel(calculation, springSetup));
            }

            solutions = solutions.Distinct().ToList();

            foreach (SolutionModel solution in solutions)
            {
                solution.SimulateSolution();
            }

            //objListOrder.Sort((x, y) => x.OrderDate.CompareTo(y.OrderDate));

            //solutions.Sort((x, y) => x.Result.CompareTo(y.Result));
        }
        public void ConnectPageModelsContentFromFiles(int step, string action, string expected)
        {
            // constants
            const string TestKey = "MODELS-60727";

            // setup
            var configuration = new RhinoConfiguration
            {
                TestsRepository  = new[] { "ModelsNoDataSource.txt" },
                Models           = new[] { "InputsModel.txt", "TablesModel.txt" },
                DriverParameters = new[]
                {
                    ChromeDriver
                }
            };

            // execute
            var actualTestStep = new TextConnector(configuration, Utilities.Types)
                                 .ProviderManager
                                 .TestRun
                                 .TestCases
                                 .First(i => i.Key == TestKey)
                                 .Steps
                                 .ElementAt(step);

            // get actuals
            var actualAction   = actualTestStep.Action;
            var actualExpected = string.Join(Environment.NewLine, actualTestStep.ExpectedResults.Select(i => i.ExpectedResult));

            // assert
            Assert.IsTrue(action.Contains(actualAction));
            Assert.AreEqual(expected: expected, actual: actualExpected);
        }
Beispiel #12
0
        public CalculationsViewer()
        {
            calculations = TextConnector.Calculations_GetAll();

            InitializeComponent();

            WireUpLists();
        }
 public CreateBearing(IBearingRequestor caller)
 {
     InitializeComponent();
     callingForm = caller;
     allBearings = TextConnector.Bearing_GetAll();
     UpdateData();
     WireUpLists();
 }
Beispiel #14
0
 public CreateCounterSleeve(ICounterSleeveRequestor caller)
 {
     InitializeComponent();
     callingForm       = caller;
     allCounterSleeves = TextConnector.CounterSleeve_GetAll();
     UpdateData();
     WireUpLists();
 }
Beispiel #15
0
 public static void InitializeConnections(DatabaseType db)
 {
     if (db == DatabaseType.TextFile)
     {
         TextConnector text = new TextConnector();
         Connections = text;
     }
 }
        public void ConnectNoTestCases()
        {
            // execute
            var testCases = new TextConnector(new RhinoConfiguration(), Utilities.Types).ProviderManager.TestRun.TestCases;

            // assert
            Assert.IsFalse(testCases.Any());
        }
Beispiel #17
0
 public static void Initialize(bool sql, bool text)
 {
     if (sql)
     {
         SqlConnector sqlconnection = new SqlConnector();
         connections.Add(sqlconnection);
     }
     if (text)
     {
         TextConnector textconnection = new TextConnector();
         //connections.Add(textconnection);
     }
 }
Beispiel #18
0
 public static void InitializeConnections(DatabaseType db)
 {
     if (db == DatabaseType.Sql)
     {
         SqlConnector sql = new SqlConnector();
         Connection = sql;
     }
     else if (db == DatabaseType.TextFile)
     {
         TextConnector text = new TextConnector();
         Connection = text;
     }
 }
        public void ConnectNoDriverParams()
        {
            // setup
            var configuration = new RhinoConfiguration
            {
                TestsRepository = GetSpecsByStub("FullSpecJson", "FullSpecMarkdownV1", "FullSpecMarkdownV2")
            };

            // execute
            var testCases = new TextConnector(configuration).ProviderManager.TestRun.TestCases;

            // assert
            Assert.IsFalse(testCases.Any());
        }
Beispiel #20
0
        public static void InitializeConnacnetion(DataBaseType db)
        {
            if (db == DataBaseType.sql)
            {
                SqlConnector sql = new SqlConnector();
                Connections = sql;
            }

            else if (db == DataBaseType.text)
            {
                TextConnector text = new TextConnector();
                Connections = text;
            }
        }
Beispiel #21
0
        public static void Init(bool data, bool text)
        {
            List <IDataConnection> connect = new List <IDataConnection>();

            if (data)
            {
                SqlConnector sql = new SqlConnector();
                connect.Add(sql);
            }
            if (text)
            {
                TextConnector textor = new TextConnector();
                connect.Add(textor);
            }
        }
Beispiel #22
0
 public static void InitializeConnection(DatabaseType database)
 {
     if (database == DatabaseType.SQL)
     {
         //TODO - nastavit sql connector spravne
         SqlConnector sql = new SqlConnector();
         Connection = sql;
     }
     if (database == DatabaseType.TEXT)
     {
         //TODO - vytvorit textove spojeni
         TextConnector text = new TextConnector();
         Connection = text;
     }
 }
 public static void InitializeConnections(bool database, bool textFiles)
 {
     if (database)
     {
         // TODO - Create the SQL Connection
         SqlConnector sql = new SqlConnector();
         Connections.Add(sql);
     }
     if (textFiles)
     {
         // TODO - Create the Text Connection
         TextConnector text = new TextConnector();
         Connections.Add(text);
     }
 }
Beispiel #24
0
        public static void InitializeConnection(StorageType storageType)
        {
            switch (storageType)
            {
            case StorageType.MySql:
                MySqlConnector sqlConnector = new MySqlConnector();
                Connection = sqlConnector;
                break;

            case StorageType.TextFile:
                TextConnector textConnector = new TextConnector();
                Connection = textConnector;
                break;
            }
        }
Beispiel #25
0
 public static void InitializeConnections(DatabaseType db)
 {
     if (db == DatabaseType.Sql)
     {
         //setup sql connector
         SqlConnector sql = new SqlConnector();
         Connection = sql;
     }
     else if (db == DatabaseType.Textfile)
     {
         //setup txt connector
         TextConnector text = new TextConnector();
         Connection = text;
     }
 }
        public static void InitializeConnections(DatabaseType db)
        {
            switch (db)
            {
            case DatabaseType.Sql:
                SqlConnector sql = new SqlConnector();
                Connection = sql;
                break;

            case DatabaseType.TextFile:
                TextConnector text = new TextConnector();
                Connection = text;
                break;
            }
        }
 public OtherPartsViewer(IPartSetRequestor caller)
 {
     InitializeComponent();
     callingForm       = caller;
     allPartSets       = TextConnector.PartSet_GetAll();
     allSleeves        = TextConnector.Sleeve_GetAll();
     allCounterSleeves = TextConnector.CounterSleeve_GetAll();
     allBearings       = TextConnector.Bearing_GetAll();
     UpdatePartSetList();
     UpdateNewPartSetGroupBoxes();
     if (selectedPartSet.Id != 0)
     {
         WireUpLists();
     }
 }
 public static void InitializeConnections(bool database, bool textFiles)
 {
     if (database)
     {
         //TODO - setup the sql connection
         SqlConnector sql = new SqlConnector();
         Connections.Add(sql);
     }
     if (textFiles)
     {
         //TODO - setup the file connection
         TextConnector text = new TextConnector();
         Connections.Add(text);
     }
 }
Beispiel #29
0
 public static void InitializeConnections(DatabaseType db)
 {
     if (db == DatabaseType.Sql)
     {
         //TODO - Create the SQL connection
         SQLConnector sql = new SQLConnector();
         Connection = sql;
     }
     else if (db == DatabaseType.TextFile)
     {
         //TODO - Create the Text connection
         TextConnector text = new TextConnector();
         Connection = text;
     }
 }
        public static void InitializeConnections(DatabaseType db)
        {
            if (db == DatabaseType.Sql)
            {
                // TODO - à faire créer connection sql
                SqlConnector sql = new SqlConnector();
                Connection = sql;
            }

            else if (db == DatabaseType.TextFile)
            {
                // TODO - à faire créer connection text
                TextConnector text = new TextConnector();
                Connection = text;
            }
        }