Exemplo n.º 1
0
 /// <summary>
 /// Returns a list of all column names.
 /// </summary>
 /// <returns></returns>
 public virtual IList <string> GetColumnHeaders()
 {
     return(HeaderElements
            .Select(e => e.TextHelper().InnerText)
            .ToList()
            .AsReadOnly());
 }
        public void CreatedEmployeeSuccessfullyAddedToEmployeeList()
        {
            new LoginPage(_driver).Login();

            var headerElement   = new HeaderElements(_driver);
            var addEmployeePage = headerElement.GoToAddEmployeePage();

            var generatedFirstName = CommonMethods.GenerateRandomString();
            var generatedLastName  = CommonMethods.GenerateRandomString();

            addEmployeePage.EnterRequiredData(generatedFirstName, generatedLastName);
            var personalDetailsPage = addEmployeePage.Save();

            var firstName  = personalDetailsPage.GetFirstName();
            var lastName   = personalDetailsPage.GetLastName();
            var employeeId = personalDetailsPage.GetEmployeeId();

            var employeeInformationPage = headerElement.GoToEmployeeInformationPage();

            employeeInformationPage.SearchEmployeeByEmployeeId(employeeId);

            var actualFirstName = employeeInformationPage.GetFirstName();
            var actualLastName  = employeeInformationPage.GetLastName();

            actualFirstName.Should().BeEquivalentTo(firstName);
            actualLastName.Should().BeEquivalentTo(lastName);
        }
Exemplo n.º 3
0
 protected void DisableExcludings()
 {
     _exludingEl.Children.Clear();
     if (HeaderElements.Contains(_exludingEl))
     {
         HeaderElements.Remove(_exludingEl);
     }
 }
Exemplo n.º 4
0
        protected void WithAvailableExcluding(Func <CompositeElement> elementGetter)
        {
            if (!_exludingEl.AvailableChildrenGetters.Contains(elementGetter))
            {
                _exludingEl.AvailableChildrenGetters.Add(elementGetter);
            }

            if (!HeaderElements.Contains(_exludingEl))
            {
                HeaderElements.Add(_exludingEl);
            }
        }
Exemplo n.º 5
0
        protected StructMatrix(IEnumerable <int> dimensions, IEnumerable <string> fieldNames)
            : base(MatlabClass.MxStructure, dimensions)
        {
            var enumerable = fieldNames as string[] ?? fieldNames.ToArray();

            if (enumerable.Length == 0)
            {
                throw new ArgumentException();
            }

            _fieldNameLength = new FieldNameLength((uint)(enumerable.Max(fn => fn.Length) + 1));
            _fieldNames      = new FieldNames(enumerable);
            HeaderElements.Add(_fieldNameLength);
            HeaderElements.Add(_fieldNames);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Search for statistics about player
        /// </summary>
        /// <param name="a_sPlayerName">Player to find</param>
        /// <returns>Statistics about player</returns>
        public PlayerStats ReadPlayerStats(string a_sPlayerName)
        {
            PlayerStats _Result = new PlayerStats();

            try
            {
                using (StreamReader sr = new StreamReader(FileName))
                {
                    _Result.Name = a_sPlayerName;

                    bool   _bIsFirstLine = true;
                    string _sLine;
                    while ((_sLine = sr.ReadLine()) != null)
                    {
                        if (_bIsFirstLine)
                        {
                            _bIsFirstLine = false;
                            continue;
                        }

                        HeaderElements _Elements = GetHeaderElements(_sLine);

                        if (_Elements.PlayerKOLKO == a_sPlayerName || _Elements.PlayerKRZYZYK == a_sPlayerName)
                        {
                            if (_Elements.Winner == a_sPlayerName)
                            {
                                _Result.Wins++;
                            }
                            else if (_Elements.Winner == " ")
                            {
                                _Result.Draw++;
                            }
                            else
                            {
                                _Result.Loses++;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(_Result);
        }
        public override object Clone()
        {
            var cloned = (CompositeElement)MemberwiseClone();

            if (IsAllowChildren)
            {
                cloned._children = null;
                Children.ToList().ForEach(x => cloned.Children.Add((ExpressionElement)x.Clone()));

                cloned._deleteOperatorCommand = null;
            }

            cloned._headerElements = null;
            HeaderElements.ToList().ForEach(x => cloned.HeaderElements.Add((ExpressionElement)x.Clone()));

            return(cloned);
        }
Exemplo n.º 8
0
 public void AddHeader(Element elt)
 {
     if (elt.ID.BinaryEquals(Elements.Info))
     {
         var s = new MemoryStream(elt.Data);
         while (s.Position < s.Length)
         {
             var child = Element.ReadHeader(s);
             if (child.ID.BinaryEquals(Elements.TimecodeScale))
             {
                 this.TimecodeScale = Element.ReadUInt(s, child.Size.Value) * 1.0;
             }
             else
             {
                 child.ReadBody(s);
             }
         }
     }
     HeaderElements.Add(elt);
 }
Exemplo n.º 9
0
        public virtual void InitializeAfterDeserialized(IExpressionViewModel expressionViewModel)
        {
            ExpressionViewModel = expressionViewModel;

            foreach (var item in HeaderElements.OfType <TypedExpressionElementBase>())
            {
                item.InitializeAfterDeserialized(expressionViewModel);
            }

            foreach (var item in _exludingEl.Children.OfType <TypedExpressionElementBase>())
            {
                item.InitializeAfterDeserialized(expressionViewModel);
            }
            _exludingEl.NewChildLabel = "+ excluding".Localize();

            foreach (var item in Children.OfType <TypedExpressionElementBase>())
            {
                item.InitializeAfterDeserialized(expressionViewModel);
            }
        }
        public void NewEmployeeCorrectlyCreated()
        {
            new LoginPage(_driver).Login();

            var addEmployeePage = new HeaderElements(_driver).GoToAddEmployeePage();

            var generatedEmployeeId = addEmployeePage.GetEmployeeId();
            var generatedFirstName  = CommonMethods.GenerateRandomString();
            var generatedLastName   = CommonMethods.GenerateRandomString();

            addEmployeePage.EnterRequiredData(generatedFirstName, generatedLastName);
            var personalDetailsPage = addEmployeePage.Save();

            var actualFirstName  = personalDetailsPage.GetFirstName();
            var actualLastName   = personalDetailsPage.GetLastName();
            var actualEmployeeId = personalDetailsPage.GetEmployeeId();

            actualEmployeeId.Should().BeEquivalentTo(generatedEmployeeId);
            actualFirstName.Should().BeEquivalentTo(generatedFirstName);
            actualLastName.Should().BeEquivalentTo(generatedLastName);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Get main information from txt file
        /// </summary>
        /// <param name="a_sLine">Line of text file</param>
        /// <returns>Main informations about winner and players</returns>
        private HeaderElements GetHeaderElements(string a_sLine)
        {
            HeaderElements _Result    = new HeaderElements();
            string         _sTemp     = string.Empty;
            int            _iSwitcher = 0;

            for (int i = 0; i < a_sLine.Length; i++)
            {
                if (a_sLine[i] == '.')
                {
                    switch (_iSwitcher)
                    {
                    case 0:
                        _Result.Lp = int.Parse(_sTemp);
                        break;

                    case 1:
                        _Result.Winner = _sTemp;
                        break;

                    case 2:
                        _Result.PlayerKOLKO = _sTemp;
                        break;

                    case 3:
                        _Result.PlayerKRZYZYK = _sTemp;
                        break;
                    }

                    _sTemp = string.Empty;
                    _iSwitcher++;
                    continue;
                }

                _sTemp += a_sLine[i];
            }

            return(_Result);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Get list of players from statistics file
        /// </summary>
        /// <returns>Players list</returns>
        public List <string> ReadPlayerList()
        {
            List <string> _oResult = new List <string>();

            try
            {
                using (StreamReader sr = new StreamReader(FileName))
                {
                    bool   _bIsFirstLine = true;
                    string _sLine;
                    while ((_sLine = sr.ReadLine()) != null)
                    {
                        if (_bIsFirstLine)
                        {
                            _bIsFirstLine = false;
                            continue;
                        }

                        HeaderElements _Elements = GetHeaderElements(_sLine);

                        if (!_oResult.Contains(_Elements.PlayerKOLKO))
                        {
                            _oResult.Add(_Elements.PlayerKOLKO);
                        }
                        if (!_oResult.Contains(_Elements.PlayerKRZYZYK))
                        {
                            _oResult.Add(_Elements.PlayerKRZYZYK);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(_oResult);
        }
Exemplo n.º 13
0
 protected ExpressionElement WithElement(ExpressionElement el)
 {
     HeaderElements.Add(el);
     return(el);
 }