Ejemplo n.º 1
1
        private void AddCustomCommandAction(OpenStreetMapProvider provider, string poi)
        {
            string commandText = string.Format("Find {0}", poi);
            string commandName = string.Format("Find{0}Command", poi);

            CommandDescription commandDescription = new CommandDescription();
            commandDescription.Command = new RoutedUICommand(commandText, commandName, typeof(OpenStreetMapProvider));
            commandDescription.CommandParameter = poi;
            commandDescription.DataTemplate = this.LayoutRoot.Resources["CustomCommandDataTemplate"] as DataTemplate;

            string imagePath = string.Format(ImagePathFormat, poi);
            commandDescription.ImageUri = new Uri(imagePath, UriKind.RelativeOrAbsolute);

            CommandBinding commandBinding = new CommandBinding(commandDescription.Command, ExecuteCustomCommand);
            provider.Commands.Add(commandDescription);
            provider.CommandBindingCollection.Add(commandBinding);
        }
        public void SerializeXMLTest()
        {
            var commandList = new CommandDescriptions();
            List <CommandDescription> command = new List <CommandDescription>();

            CommandDescription commandDescription = new CommandDescription();

            commandDescription.Name           = "Phase A power consumption";
            commandDescription.TestTargetType = Production.PCBTest.TestTargetType.Meter;
            commandDescription.ResoureId      = "Item_PhaseAPowerConsumption";
            //commandDescription.CommandType = new MeasureActivePowerCommand();
            commandDescription.CommandType      = "MeasureActivePowerCommand";
            commandDescription.ErrorControlType = "RangeSelector";

            var commandParameter = new MeasureParameter();

            commandParameter.LowerLimit         = 0.6m;
            commandParameter.UpperLimit         = 1.0m;
            commandParameter.Phase              = Phase.A;
            commandParameter.PinNumber          = 0;
            commandParameter.CurrentRange       = CurrentRange.All;
            commandDescription.CommandParameter = commandParameter;


            command.Add(commandDescription);
            commandList.Command = command;
            SerializeHelper.SerializeXML <CommandDescriptions>(commandList, @"H:\WorkSpace\rPCBT\PCBTestUtility\Xml\XmlTest.xml");
            //Assert.Fail();
        }
Ejemplo n.º 3
0
        public void WriteTo_FailingAssertionForPerspectiveWithInvestigationReturningNoField_TextContainsFewKeyInfo()
        {
            var description = new CommandDescription(Target.MeasureGroups,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
            });


            var actuals = new string[] {};

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var existsConstraint = new ExistsConstraint("expected-measure-group-caption");

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, existsConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("nothing found"));
        }
Ejemplo n.º 4
0
        public void WriteTo_FailingAssertionForDimensionWithMinorMistake_TextContainsTheSuggestionOfValue()
        {
            var description = new CommandDescription(Target.MeasureGroups,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
            });


            var actuals = new string[] { "expected-dimension-catpion" };

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var existsConstraint = new ExistsConstraint("expected-dimension-caption");

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, existsConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("The value 'expected-dimension-catpion' is close to your expectation."));
        }
Ejemplo n.º 5
0
        public MainWindow()
        {
            InitializeComponent();

            OpenStreetMapProvider provider = new OpenStreetMapProvider()
            {
                // This user agent should be set per application.
                // Please specify different string in your application.
                StandardModeUserAgent = "Telerik UI for WPF SDK samples"
            };

            provider.Commands.Clear();

            this.AddCustomCommandAction(provider, "Restaurants");
            this.AddCustomCommandAction(provider, "Bars");
            this.AddCustomCommandAction(provider, "Museums");

            CommandDescription commandDescription = new CommandDescription()
            {
                Command          = new DelegateCommand(this.ExecuteCommand),
                CommandParameter = "test",
                DataTemplate     = this.Resources["CustomTemplate2"] as DataTemplate
            };

            provider.Commands.Add(commandDescription);

            this.RadMap1.Provider = provider;
        }
Ejemplo n.º 6
0
        public void WriteTo_FailingAssertionForDimension_TextContainsCaptionOfExpectedDimensionAndNameOfPerspective()
        {
            var description = new CommandDescription(Target.Dimensions,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
            });

            var actuals = new string[] { "Actual dimension 1", "Actual dimension 2", "Actual dimension 3" };

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var existsConstraint = new ExistsConstraint("expected-dimension-caption");

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, existsConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("perspective-name").And
                        .StringContaining("expected-dimension-caption"));
        }
Ejemplo n.º 7
0
        public void Matches_GivenCommand_CommandExecuteCalledOnce()
        {
            var exp         = "Expected hierarchy";
            var description = new CommandDescription(Target.Hierarchies,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.Dimensions, "dimension-caption")
            });

            var actuals = new string[] { "Actual hierarchy 1" };

            var commandMock = new Mock <IStructureDiscoveryCommand>();

            commandMock.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandMock.Setup(cmd => cmd.Description).Returns(description);


            var containsConstraint = new ContainConstraint(exp)
            {
            };

            //Method under test
            containsConstraint.Matches(commandMock.Object);

            //Test conclusion
            commandMock.Verify(cmd => cmd.Execute(), Times.Once());
        }
Ejemplo n.º 8
0
        public void UpdateHelp()
        {
            if (commands == null)
            {
                return;
            }
            string l = lines[row].Trim();
            int    p = l.IndexOf(' ');

            if (p == -1)
            {
                p = l.Length;
            }
            string com = l.Substring(0, p);

            if (com.Equals(lastHelpCommand))
            {
                return;
            }
            lastHelpCommand = com;
            CommandDescription desc = null;

            if (commands.commands.ContainsKey(com))
            {
                desc = commands.commands[com];
            }
            if (desc == null)
            {
                help.Rtf = "";
                return;
            }
            StringBuilder s = new StringBuilder();

            s.Append("{\\rtf1\\ansi \\b ");
            s.Append(desc.command);
            s.Append(":");
            s.Append(desc.title);
            s.Append("\\b0 \\line Syntax:");
            s.Append(desc.command);
            s.Append(" ");
            foreach (CommandParameter pa in desc.parameter)
            {
                s.Append(pa);
            }
            s.Append("\\line ");
            s.Append(desc.description);
            s.Append("}");
            help.Rtf = s.ToString();
            //help.Rtf = @"{\rtf1\ansi This text is in \b bold\b0, " +
//@"this is in \i italics\i0, " +
//@"and this is \ul underlined\ul0.}";

            return;
        }
Ejemplo n.º 9
0
        private void DisableCommand(MapProviderBase provider, string commandParameter)
        {
            CommandDescription command = (from cmd in provider.Commands
                                          where (string)cmd.CommandParameter == commandParameter
                                          select cmd).FirstOrDefault();

            if (command != null)
            {
                command.IsAllowed = false;
            }
        }
Ejemplo n.º 10
0
        public async Task AddOrUpdateCommandDescription(long gid, CommandDescription commandDescription)
        {
            string verboseMessage = $"{baseLogString} entering AddOrUpdateCommandDescription method.";

            Logger.LogVerbose(verboseMessage);

            while (!ReliableDictionariesInitialized)
            {
                await Task.Delay(1000);
            }

            await CommandDescriptionCache.SetAsync(gid, commandDescription);
        }
Ejemplo n.º 11
0
        private void SetCustomZoomLevelLabel(int zoomLevel, string label)
        {
            CommandDescription description = (from cmd in this.radMap.MapZoomBar.Commands
                                              where (int)cmd.CommandParameter == zoomLevel
                                              select cmd).FirstOrDefault();

            if (description != null)
            {
                RoutedUICommand command = description.Command as RoutedUICommand;
                if (command != null)
                {
                    command.Text = label;
                }
            }
        }
        public StructureDiscoveryCommand Instantiate(Target target, TargetType type, IEnumerable<CaptionFilter> filters)
        {
            var builder = InstantiateBuilder(target);
            builder.Build(filters);

            var cmd = connection.CreateCommand();
            cmd.CommandText = builder.GetCommandText();
            var postFilters = builder.GetPostFilters();

            var description = new CommandDescription(target, filters);

            var command = new RelationalCommand(cmd, postFilters, description);

            return command;
        }
Ejemplo n.º 13
0
        public IDataTypeDiscoveryCommand Instantiate(Target target, IEnumerable <CaptionFilter> filters)
        {
            var builder = InstantiateBuilder(target);

            builder.Build(filters);

            var cmd = connection.CreateCommand();

            cmd.CommandText = builder.GetCommandText();

            var description = new CommandDescription(target, filters);

            var command = new RelationalCommand(cmd, description);

            return(command);
        }
Ejemplo n.º 14
0
        public void WriteTo_FailingAssertionForListOfLevels_TextContainsFewKeyInfo()
        {
            var exp = new string[] { "Expected level 1", "Expected level 2" };

            var description = new CommandDescription(
                Target.Levels,
                new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.Dimensions, "dimension-caption")
                , new CaptionFilter(Target.Hierarchies, "hierarchy-caption")
            });


            var actuals = new string[] { "Actual level 1", "Actual level 2", "Actual level 3" };

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var containsConstraint = new EquivalentToConstraint(exp);

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, containsConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Assert.That(assertionText, Does.Contain("exact").And
                        .StringContaining("perspective-name").And
                        .StringContaining("dimension-caption").And
                        .StringContaining("hierarchy-caption").And
                        .StringContaining("levels").And
                        .StringContaining("Expected level 1").And
                        .StringContaining("Expected level 2"));
        }
Ejemplo n.º 15
0
        private void ShowToolTipAfterTimerFired(object sender, EventArgs e)
        {
            if (StoredPreferences.Instance.ShowToolTips)
            {
                Point p = (Point)m_timer.Tag;

                // only show a new tool tip, if the position changes
                if (m_lastToolTipLocation.Equals(p))
                {
                    return;
                }

                m_lastToolTipLocation = p;

                int cmdIndex = GetCommandIndex(p);
                if (cmdIndex == -1)
                {
                    return;
                }

                int from   = m_commandIndeces[cmdIndex].Item1;
                int length = m_commandIndeces[cmdIndex].Item2 - m_commandIndeces[cmdIndex].Item1;

                string commandString = m_txtCmds.Text.Substring(from, length);

                Command             cmd = null;
                string              errorDescription = "";
                CommandStringParser parser           = new CommandStringParser(commandString);
                bool valid = parser.ParseCommand(commandString, false, out cmd, out errorDescription);
                if (valid)
                {
                    // print command action to text box
                    foreach (Attribute attr in Attribute.GetCustomAttributes(cmd.GetType()).Where(a => a is CommandDescription))
                    {
                        CommandDescription descr   = (CommandDescription)attr;
                        string             toolTip = descr.Description;

                        m_toolTip.Show(toolTip, this, p.X, p.Y + 20, 10000);
                        break;
                    }
                }
            }
        }
        public StructureDiscoveryCommand Instantiate(Target target, TargetType type, IEnumerable <IFilter> filters)
        {
            var builder = InstantiateBuilder(target);

            builder.Build(filters);

            var cmd = connection.CreateCommand();

            cmd.CommandText = builder.GetCommandText();
            var postFilters = builder.GetPostFilters();

            var description = new CommandDescription(target, filters);

            RelationalCommand command = null;

            command = new RelationalCommand(cmd, postFilters, description);

            return(command);
        }
Ejemplo n.º 17
0
        public void WriteTo_FailingAssertionForNumericTypeVersusSimpleType_TextContainsTwoTypeNamesButNotLength()
        {
            var description = new CommandDescription(Target.Columns,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.Tables, "table-name")
                , new CaptionFilter(Target.Columns, "ccc-name")
            });

            var actual = new NumericInfo()
            {
                Name = "decimal", Scale = 10, Precision = 3
            };

            var commandStub = new Mock <IDataTypeDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("varchar");

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, isConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("varchar").And
                        .StringContaining("decimal").And
                        .Not.StringContaining("10").And
                        .Not.StringContaining("3")
                        );
        }
Ejemplo n.º 18
0
        private void AddCustomCommandAction(OpenStreetMapProvider provider, string poi)
        {
            string commandText = string.Format("Find {0}", poi);
            string commandName = string.Format("Find{0}Command", poi);

            CommandDescription commandDescription = new CommandDescription();

            commandDescription.Command          = new RoutedUICommand(commandText, commandName, typeof(OpenStreetMapProvider));
            commandDescription.CommandParameter = poi;
            commandDescription.DataTemplate     = this.LayoutRoot.Resources["CustomCommandDataTemplate"] as DataTemplate;

            string imagePath = string.Format(ImagePathFormat, poi);

            commandDescription.ImageUri = new Uri(imagePath, UriKind.RelativeOrAbsolute);

            CommandBinding commandBinding = new CommandBinding(commandDescription.Command, ExecuteCustomCommand);

            provider.Commands.Add(commandDescription);
            provider.CommandBindingCollection.Add(commandBinding);
        }
Ejemplo n.º 19
0
 private void CommandInterfaceCtrl_Load(object sender, EventArgs e)
 {
     m_cmdBoxCommands.Items.Clear();
     foreach (Type t in CommandStringParser.GetAllCommandTypes())
     {
         bool publish = true;
         foreach (Attribute attr in Attribute.GetCustomAttributes(t))
         {
             if (attr is CommandDescription)
             {
                 CommandDescription descr = (CommandDescription)attr;
                 publish = descr.Publish;
             }
         }
         if (!publish)
         {
             continue;
         }
         m_cmdBoxCommands.Items.Add(t.Name);
     }
 }
Ejemplo n.º 20
0
        public void Matches_Default_Success()
        {
            var description = new CommandDescription(Target.MeasureGroups,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
            });


            var actuals = new string[] { "a", "b", "c" };

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var existsConstraint = new ExistsConstraint("a");

            //Method under test
            Assert.That(commandStub.Object, existsConstraint);
        }
Ejemplo n.º 21
0
        public void WriteTo_FailingAssertionForSimpleType_TextContainsName()
        {
            var description = new CommandDescription(Target.Columns,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.Tables, "table-name")
                , new CaptionFilter(Target.Columns, "ccc-name")
            });

            var actual = new DataTypeInfo()
            {
                Name = "bit"
            };

            var commandStub = new Mock <IDataTypeDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("int");

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, isConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("bit").And
                        .StringContaining("int")
                        );
        }
Ejemplo n.º 22
0
        public void WriteTo_FailingAssertionForOneMeasureGroup_TextContainsFewKeyInfo()
        {
            var exp         = "Expected measure";
            var description = new CommandDescription(Target.Hierarchies,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.MeasureGroups, "measure-group-caption")
            });


            var actuals = new string[] { "Actual hierarchy 1" };

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var containsConstraint = new ContainConstraint(exp)
            {
            };

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, containsConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Assert.That(assertionText, Is.StringContaining("perspective-name").And
                        .StringContaining("measure-group-caption").And
                        .StringContaining("Expected measure"));
        }
Ejemplo n.º 23
0
        public StructureDiscoveryCommand Instantiate(Target target, TargetType type, IEnumerable <IFilter> filters)
        {
            if (!(connection is AdomdConnection))
            {
                throw new ArgumentException();
            }

            var builder = InstantiateBuilder(target, type);

            builder.Build(filters);

            var cmd = connection.CreateCommand();

            cmd.CommandText = builder.GetCommandText();
            var postFilters = builder.GetPostFilters();

            var description = new CommandDescription(target, filters);

            OlapCommand command = null;

            if ((target == Target.MeasureGroups && type == TargetType.Object) || target == Target.Perspectives)
            {
                command = new DistinctOlapCommand(cmd, postFilters, description);
            }
            else if (target == Target.Dimensions && type == TargetType.Object)
            {
                command = new DimensionCommand(cmd, postFilters, description);
            }
            else if (target == Target.Dimensions && type == TargetType.Relation)
            {
                command = new DimensionRelationCommand(cmd, postFilters, description);
            }
            else
            {
                command = new OlapCommand(cmd, postFilters, description);
            }

            return(command);
        }
Ejemplo n.º 24
0
        public void WriteTo_FailingAssertionForTwoPerspectives_TextContainsFewKeyInfo()
        {
            var exp         = new string[] { "Expected perspective 1", "Expected perspective 2" };
            var description = new CommandDescription(Target.Perspectives,
                                                     new CaptionFilter[] { });


            var actuals = new string[] { "Actual perspective 1", "Actual perspective 2" };

            var commandStub = new Mock <IStructureDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var containsConstraint = new ContainConstraint(exp)
            {
            };

            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(commandStub.Object, containsConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Assert.That(assertionText, Is.StringContaining("find the perspectives named").And
                        .StringContaining("Expected perspective 1").And
                        .StringContaining("Expected perspective 2").And
                        .StringContaining(".").And
                        .StringContaining("Actual perspective 1").And
                        .StringContaining("Actual perspective 2").And
                        .Not.StringContaining("contain"));
        }
Ejemplo n.º 25
0
        public MainPage()
        {
            InitializeComponent();

            OpenStreetMapProvider provider = new OpenStreetMapProvider();

            provider.Commands.Clear();

            this.AddCustomCommandAction(provider, "Restaurants");
            this.AddCustomCommandAction(provider, "Bars");
            this.AddCustomCommandAction(provider, "Museums");

            CommandDescription commandDescription = new CommandDescription()
            {
                Command = new DelegateCommand(this.ExecuteCommand),
                CommandParameter = "test",
                DataTemplate = this.Resources["CustomTemplate2"] as DataTemplate
            };

            provider.Commands.Add(commandDescription);

            this.RadMap1.Provider = provider;
        }
Ejemplo n.º 26
0
        public void Matches_GivenCommand_ExecuteCalledOnce()
        {
            var description = new CommandDescription(Target.Dimensions,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
            });

            var actuals = new string[] { "Actual dimension 1", "Actual dimension 2", "Actual dimension 3" };

            var commandMock = new Mock <IStructureDiscoveryCommand>();

            commandMock.Setup(cmd => cmd.Execute()).Returns(actuals);
            commandMock.Setup(cmd => cmd.Description).Returns(description);

            var existConstraint = new ExistsConstraint("expected-dimension-caption");

            //Method under test
            existConstraint.Matches(commandMock.Object);

            //Test conclusion
            commandMock.Verify(cmd => cmd.Execute(), Times.Once());
        }
Ejemplo n.º 27
0
        public MainWindow()
        {
            InitializeComponent();

            OpenStreetMapProvider provider = new OpenStreetMapProvider();

            provider.Commands.Clear();

            this.AddCustomCommandAction(provider, "Restaurants");
            this.AddCustomCommandAction(provider, "Bars");
            this.AddCustomCommandAction(provider, "Museums");

            CommandDescription commandDescription = new CommandDescription()
            {
                Command          = new DelegateCommand(this.ExecuteCommand),
                CommandParameter = "test",
                DataTemplate     = this.Resources["CustomTemplate2"] as DataTemplate
            };

            provider.Commands.Add(commandDescription);

            this.RadMap1.Provider = provider;
        }
Ejemplo n.º 28
0
        public void Matches_Varchar10WithVarchar20_Failure()
        {
            var description = new CommandDescription(Target.Columns,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.Tables, "table-name")
                , new CaptionFilter(Target.Columns, "ccc-name")
            });
            var actual = new TextInfo()
            {
                Name = "varchar", Length = 10
            };

            var commandStub = new Mock <IDataTypeDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("varchar(20)");

            //Method under test
            Assert.Throws <AssertionException>(delegate { Assert.That(commandStub.Object, isConstraint); });
        }
Ejemplo n.º 29
0
        public void Matches_Decimal10Coma3WithDecimal10Coma2_Failure()
        {
            var description = new CommandDescription(Target.Columns,
                                                     new CaptionFilter[]
            {
                new CaptionFilter(Target.Perspectives, "perspective-name")
                , new CaptionFilter(Target.Tables, "table-name")
                , new CaptionFilter(Target.Columns, "ccc-name")
            });
            var actual = new NumericInfo()
            {
                Name = "decimal", Scale = 10, Precision = 3
            };

            var commandStub = new Mock <IDataTypeDiscoveryCommand>();

            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("decimal(10,2)");

            //Method under test
            Assert.Throws <AssertionException>(delegate { Assert.That(commandStub.Object, isConstraint); });
        }
Ejemplo n.º 30
0
 internal CommandProxy(CommandDescription description, MappingType mappingType)
 {
     _description = description;
     MappingType  = mappingType;
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Registers a debug command that is "fired" when the specified command string is entered.
        /// </summary>
        /// <param name="commandString">The string that represents the command. For example: "FOV"</param>
        /// <param name="commandCallback">The method/function to call with the commandString is entered.
        /// For example: "SetFOV"</param>

        public static void RegisterCommand(CommandDescription command) {
            CoreConsole.Instance.RegisterCommandCallback(command, command.callback);
        }
Ejemplo n.º 32
0
 //--- Local version. Use the static version above instead.
 void RegisterCommandCallback(CommandDescription command, DebugCommand commandCallback) {
     _cmdTable[command.command.ToLower()] = new DebugCommand(commandCallback);
     _commandDescriptions.Add(command.command, command);
 }
Ejemplo n.º 33
0
 public RelationalCommand(IDbCommand command, CommandDescription description)
     : base(command, description)
 {
 }
Ejemplo n.º 34
0
 public DistinctOlapCommand(IDbCommand command, IEnumerable <IPostCommandFilter> postFilters, CommandDescription description)
     : base(command, postFilters, description)
 {
 }
Ejemplo n.º 35
0
 public RelationalCommand(IDbCommand command, CommandDescription description)
     : base(command, description)
 {
 }
Ejemplo n.º 36
0
 public Task AddOrUpdateCommandDescription(long gid, CommandDescription commandDescription)
 {
     //return MethodWrapperAsync("AddOrUpdateCommandDescription", new object[2] { gid, commandDescription });
     return(InvokeWithRetryAsync(client => client.Channel.AddOrUpdateCommandDescription(gid, commandDescription)));
 }