Exemplo n.º 1
0
        protected void AddColumnIfNotExists <T>(IEnumerable <ColumnInfo> columns, string tableName, string columnName)
        {
            var table = DefinitionFactory.GetTableDefinition(typeof(T), SqlSyntax);

            if (columns.Any(x => x.TableName.InvariantEquals(tableName) && !x.ColumnName.InvariantEquals(columnName)))
            {
                AddColumn(table, tableName, columnName);
            }
        }
Exemplo n.º 2
0
 public InfoMagneticVariationTest()
 {
     this.model = new InfoMagneticVariation(
         12.154,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 3
0
 public InfoLongitudeTest()
 {
     this.model = new InfoLongitude(
         "def",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 4
0
 public InfoNameTest()
 {
     this.model = new InfoName(
         "Super Cool Sector",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
        private void DeleteIndex <TDto>(string indexName)
        {
            var tableDef = DefinitionFactory.GetTableDefinition(typeof(TDto), Context.SqlContext.SqlSyntax);

            if (IndexExists(indexName))
            {
                Delete.Index(indexName).OnTable(tableDef.Name).Do();
            }
        }
Exemplo n.º 6
0
        public void TestItReturnsElementsInOrder()
        {
            OutputGroup group1 = new("1");
            OutputGroup group2 = new("2");

            outputGroups.AddGroupWithFiles(group1, new List <string> {
                "foo.txt"
            });
            outputGroups.AddGroupWithFiles(group2, new List <string> {
                "goo.txt"
            });

            ControllerPosition first = ControllerPositionFactory.Make(
                order: PositionOrder.MENTOR_POSITION,
                definition: DefinitionFactory.Make("goo.txt")
                );
            ControllerPosition second = ControllerPositionFactory.Make(
                order: PositionOrder.MENTOR_POSITION,
                definition: DefinitionFactory.Make("foo.txt")
                );
            ControllerPosition third = ControllerPositionFactory.Make(
                order: PositionOrder.PRE_POSITION,
                definition: DefinitionFactory.Make("foo.txt")
                );
            ControllerPosition fourth = ControllerPositionFactory.Make(
                order: PositionOrder.CONTROLLER_POSITION,
                definition: DefinitionFactory.Make("goo.txt")
                );
            ControllerPosition fifth = ControllerPositionFactory.Make(
                order: PositionOrder.CONTROLLER_POSITION,
                definition: DefinitionFactory.Make("foo.txt")
                );
            ControllerPosition sixth = ControllerPositionFactory.Make(
                order: PositionOrder.CONTROLLER_POSITION,
                definition: DefinitionFactory.Make("foo.txt")
                );

            sectorElements.Add(first);
            sectorElements.Add(second);
            sectorElements.Add(third);
            sectorElements.Add(fourth);
            sectorElements.Add(fifth);
            sectorElements.Add(sixth);

            IEnumerable <ICompilableElementProvider> expected = new List <ICompilableElementProvider>()
            {
                third,
                fifth,
                sixth,
                fourth,
                second,
                first
            };

            AssertCollectedItems(expected);
        }
Exemplo n.º 7
0
 public FixTest()
 {
     this.fix = new Fix(
         "ADMAG",
         new Coordinate("abc", "def"),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 8
0
 public RegionTest()
 {
     this.region = new Region(
         "Region1",
         this.points,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 9
0
 public SectorActiveTest()
 {
     this.model = new SectorActive(
         "EGLL",
         "09R",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 10
0
 public ColourTest()
 {
     this.colour = new Colour(
         "colour1",
         123,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 11
0
 public RunwayCentrelineTest()
 {
     segment    = RunwayCentrelineSegmentFactory.Make();
     centreline = new RunwayCentreline(
         segment,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
 public SectorlineDisplayRuleTest()
 {
     this.model = new SectorlineDisplayRule(
         "Deancross",
         "Deancross",
         "East",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 13
0
 public NdbTest()
 {
     this.model = new Ndb(
         "BRI",
         "123.456",
         new Coordinate("abc", "def"),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
 public SectorGuestTest()
 {
     this.model = new SectorGuest(
         "MWAL",
         "EGBB",
         "*",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 15
0
 public FreetextTest()
 {
     this.model = new Freetext(
         "Freetext",
         "Some text",
         new Coordinate("abc", "def"),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 16
0
 public GeoSegmentTest()
 {
     this.segment = new GeoSegment(
         new Point(new Coordinate("abc", "def")),
         new Point(new Coordinate("ghi", "jkl")),
         "red",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 17
0
        protected void AlterColumn <T>(string tableName, string columnName)
        {
            var table  = DefinitionFactory.GetTableDefinition(typeof(T), SqlSyntax);
            var column = table.Columns.First(x => x.Name == columnName);

            SqlSyntax.Format(column, SqlSyntax.GetQuotedTableName(tableName), out var sqls);
            foreach (var sql in sqls)
            {
                Execute.Sql(sql).Do();
            }
        }
Exemplo n.º 18
0
 public LabelTest()
 {
     this.label = new Label(
         "label 1",
         new Coordinate("abc", "def"),
         "colour",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 19
0
 public ActiveRunwayTest()
 {
     this.activeRunway = new ActiveRunway(
         "33",
         "EGBB",
         1,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 20
0
 public RouteSegmentTest()
 {
     this.segment = new RouteSegment(
         "FOO",
         new Point("BIG"),
         new Point("LAM"),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 21
0
 private void AddNewDefinition <TEntity>()
     where TEntity : class
 {
     lock (Locker)
     {
         if (!Definitions.ContainsKey(typeof(TEntity)))
         {
             Definitions.Add(typeof(TEntity), DefinitionFactory.Create <TEntity>(this));
         }
     }
 }
        private void DeleteIndexes <T>(params string[] toDelete)
        {
            var tableDef = DefinitionFactory.GetTableDefinition(typeof(T), Context.SqlContext.SqlSyntax);

            foreach (var i in toDelete)
            {
                if (IndexExists(i))
                {
                    Delete.Index(i).OnTable(tableDef.Name).Do();
                }
            }
        }
Exemplo n.º 23
0
 private static AirwaySegment GetAirway(AirwayType type, string startPointIdentifier, string endPointIdentifier)
 {
     return(new(
                "test",
                type,
                new Point(startPointIdentifier),
                new Point(endPointIdentifier),
                DefinitionFactory.Make(),
                DocblockFactory.Make(),
                CommentFactory.Make()
                ));
 }
        public AbstractSectorElementTest()
        {
            this.docblock   = DocblockFactory.Make();
            this.comment    = CommentFactory.Make();
            this.definition = DefinitionFactory.Make();

            this.element = new MockSectorElement(
                this.definition,
                this.docblock,
                this.comment
                );
        }
 public ArtccSegmentTest()
 {
     this.artcc = new ArtccSegment(
         "EGTT",
         ArtccType.HIGH,
         new Point("abc"),
         new Point("def"),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Exemplo n.º 26
0
        private void SelectTargetFile(object sender, EventArgs e)
        {
            _targetStream?.Dispose();
            targetGridView.Rows.Clear();

            var fileName = string.Empty;

            using (var dialog = new OpenFileDialog())
            {
                dialog.Title  = "Select the file to use as reference.";
                dialog.Filter = "DBC files (*.dbc, *.db2)|*.dbc;*.db2";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    fileName = dialog.FileName;
                }
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            textBox2.Text = fileName;

            _targetStream       = File.OpenRead(fileName);
            _targetFileAnalyzer = AnalyzerFactory.Create(_targetStream);

            if (Properties.Settings.Default.LoadTargetDefinition)
            {
                var definitionName = Path.GetFileNameWithoutExtension(fileName);
                if (!_definitionContainer.TryGetValue(definitionName, out var definitionStore) || definitionStore == null)
                {
                    definitionStore = _definitionContainer[definitionName] = DefinitionFactory.Open(definitionName);
                }

                var fileType = definitionStore[_targetFileAnalyzer.LayoutHash];
                _targetFileAnalyzer = AnalyzerFactory.Create(fileType, _targetStream);

                // Add to GUI
                ShowTypeToGUI(_targetFileAnalyzer.RecordType, targetGridView);
            }
            else
            {
                var definitionName = Path.GetFileNameWithoutExtension(fileName);
                if (_definitionContainer.TryGetValue(definitionName, out var definitionStore))
                {
                    if (definitionStore.ContainsKey(_targetFileAnalyzer.LayoutHash))
                    {
                        throw new InvalidOperationException("Structure is already known");
                    }
                }
            }
        }
Exemplo n.º 27
0
        public NovaSettingsManager()
        {
            _definitions = new Dictionary <string, IDefinition>();

            //TODO;
            _factory = new ComboBoxFactory(); //Good starter since it's a special case.
            _factory.SetSuccessor <RadioButtonFactory>()
            .SetSuccessor <CheckBoxFactory>()
            .SetSuccessor <DatePickerFactory>()
            //..........
            .SetSuccessor <TextBoxFactory>();    //Decent Fallback in case nothing matches.
        }
Exemplo n.º 28
0
 public AirwaySegmentTest()
 {
     this.airway = new AirwaySegment(
         "UN864",
         AirwayType.HIGH,
         new Point("ABCDE"),
         new Point("FGHIJ"),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
        private void CreateIndex <TDto>(string indexName)
        {
            var tableDef = DefinitionFactory.GetTableDefinition(typeof(TDto), Context.SqlContext.SqlSyntax);

            // get the definition by name
            var index = tableDef.Indexes.First(x => x.Name == indexName);

            new ExecuteSqlStatementExpression(Context)
            {
                SqlStatement = Context.SqlContext.SqlSyntax.Format(index)
            }.Execute();
        }
Exemplo n.º 30
0
 public AirportTest()
 {
     this.airport = new Airport(
         "Testville",
         "EGTT",
         new Coordinate("abc", "def"),
         "123.456",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }