public void GetWebsiteNameForGoCommandTest()
        {
            var commandSegments = new List <string> {
                "go", "to", "google"
            };                            // The command provided by the user
            var    expected = "facebook"; // Expected value
            string actual;

            actual = CommandParametersManager.GetWebsiteNameForGoCommand(commandSegments);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method will return the command type with/without parameters to be executed
        /// </summary>
        /// <param name="commandTypes"></param>
        /// <param name="command"></param>
        /// <returns></returns>
        private static Dictionary <CommandType, object> GetCommandDetails(IReadOnlyCollection <CommandType> commandTypes, string command)
        {
            try
            {
                var resultDictionary = new Dictionary <CommandType, object>();
                if (commandTypes == null)
                {
                    return(null);
                }
                if (commandTypes.Count == 1)
                {
                    var commandType = commandTypes.FirstOrDefault();
                    switch (commandType)
                    {
                    case CommandType.go:
                    {
                        resultDictionary.Add(commandType, CommandParametersManager.GetWebsiteNameForGoCommand(command.Split(' ').ToList()));
                        break;
                    }

                    case CommandType.go_to_tab:
                    {
                        resultDictionary.Add(commandType, CommandParametersManager.GetTabIndexForGoToTabCommand(command));
                        break;
                    }

                    case CommandType.move:
                    {
                        resultDictionary.Add(commandType, CommandParametersManager.GetxyValuesToMouseMoveCommand(command));
                        break;
                    }

                    default:
                    {
                        resultDictionary.Add(commandType, "");
                        break;
                    }
                    }
                }
                return(resultDictionary);
            }
            catch (Exception ex)
            {
                Log.ErrorLog(ex);
                throw;
            }
        }