public override int GetHashCode()
        {
            int hash = 1;

            if (resultCase_ == ResultOneofCase.ParseError)
            {
                hash ^= ParseError.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.SerializeError)
            {
                hash ^= SerializeError.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.RuntimeError)
            {
                hash ^= RuntimeError.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.ProtobufPayload)
            {
                hash ^= ProtobufPayload.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.JsonPayload)
            {
                hash ^= JsonPayload.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.Skipped)
            {
                hash ^= Skipped.GetHashCode();
            }
            hash ^= (int)resultCase_;
            return(hash);
        }
 public string Format(string template, string description)
 {
     return(template.FormatInvariant(
                description.NaIfEmpty(),
                TotalProcessed.ToString("N0"), TotalRecords.ToString("N0"),
                Success.ToString("N0"), Failure.ToString("N0"), Skipped.ToString("N0"),
                Added.ToString("N0"), Updated.ToString("N0")));
 }
        public void ApplySkipped(List <string> skipped)
        {
            skipped.Clear();

            if (HasContinuation)
            {
                skipped.AddRange(Skipped.Select(s => s.JdaShiftId).ToArray());
            }
        }
Пример #4
0
        public override int GetHashCode()
        {
            int hash = ProjectDirectory?.GetHashCode() ?? 1 * 23;

            hash += (ProjectName?.GetHashCode() ?? 1 * 23);
            hash += (OutputMSBuildProject?.GetHashCode() ?? 1 * 23);
            hash += (Errors?.Sum(e => e.GetHashCode() * 17) ?? 1 * 23);
            hash += (Warnings?.Sum(w => w.GetHashCode() * 17) ?? 1 * 23);
            hash += (PreExistingCsprojDependencies?.Sum(p => p.GetHashCode() * 17) ?? 1 * 23);
            hash += (Skipped.GetHashCode() * 23);
            hash += (Failed.GetHashCode() * 23);
            hash += (Succeeded.GetHashCode() * 23);
            return(hash);
        }
        public override string ToString()
        {
            if (!Content.Contains("{"))
            {
                return(Content);
            }

            var str = Content.FormatInvariant(
                Description.NaIfEmpty(),
                (int)Math.Round(ProcessedPercent),
                TotalProcessed.ToString("N0"), TotalRecords.ToString("N0"),
                Success.ToString("N0"), Failure.ToString("N0"), Skipped.ToString("N0"),
                Added.ToString("N0"), Updated.ToString("N0")
                );

            return(str);
        }
Пример #6
0
 private void OnContinueButtonPointerUp()
 {
     Skipped?.Invoke();
 }
 public void Skip()
 {
     IsSkipped   = true;
     IsAutorized = false;
     Skipped?.Invoke();
 }
Пример #8
0
        /// <summary>
        /// returns token with longest best match
        /// </summary>
        /// <returns></returns>
        public Token LookAhead(params TokenType[] expectedtokens)
        {
            int              i;
            int              startpos    = StartPosition;
            int              endpos      = EndPosition;
            int              currentline = CurrentLine;
            string           currentFile = CurrentFile;
            Token            tok         = null;
            List <TokenType> scantokens;


            // this prevents double scanning and matching
            // increased performance
            if (LookAheadToken != null &&
                LookAheadToken.Type != TokenType._UNDETERMINED_ &&
                LookAheadToken.Type != TokenType._NONE_)
            {
                return(LookAheadToken);
            }

            // if no scantokens specified, then scan for all of them (= backward compatible)
            if (expectedtokens.Length == 0)
            {
                scantokens = Tokens;
            }
            else
            {
                scantokens = new List <TokenType>(expectedtokens);
                scantokens.AddRange(SkipList);
            }

            do
            {
                int       len   = -1;
                TokenType index = (TokenType)int.MaxValue;
                string    input = Input.Substring(startpos);

                tok = new Token(startpos, endpos);

                for (i = 0; i < scantokens.Count; i++)
                {
                    Regex r = Patterns[scantokens[i]];
                    Match m = r.Match(input);
                    if (m.Success && m.Index == 0 && ((m.Length > len) || (scantokens[i] < index && m.Length == len)))
                    {
                        len   = m.Length;
                        index = scantokens[i];
                    }
                }

                if (index >= 0 && len >= 0)
                {
                    tok.EndPosition = startpos + len;
                    tok.Text        = Input.Substring(tok.StartPosition, len);
                    tok.Type        = index;
                }
                else if (tok.StartPosition == tok.EndPosition)
                {
                    if (tok.StartPosition < Input.Length)
                    {
                        tok.Text = Input.Substring(tok.StartPosition, 1);
                    }
                    else
                    {
                        tok.Text = "EOF";
                    }
                }

                // Update the line and column count for error reporting.
                tok.File = currentFile;
                tok.Line = currentline;
                if (tok.StartPosition < Input.Length)
                {
                    tok.Column = tok.StartPosition - Input.LastIndexOf('\n', tok.StartPosition);
                }

                if (SkipList.Contains(tok.Type))
                {
                    startpos    = tok.EndPosition;
                    endpos      = tok.EndPosition;
                    currentline = tok.Line + (tok.Text.Length - tok.Text.Replace("\n", "").Length);
                    currentFile = tok.File;
                    Skipped.Add(tok);
                }
                else
                {
                    // only assign to non-skipped tokens
                    tok.Skipped = Skipped;                     // assign prior skips to this token
                    Skipped     = new List <Token>();          //reset skips
                }
            }while (SkipList.Contains(tok.Type));

            LookAheadToken = tok;
            return(tok);
        }
Пример #9
0
        public void SerializeAsNUnit(string xmlFile)
        {
            var doc         = new XmlDocument();
            var declaration = doc.CreateXmlDeclaration("1.0", "utf-8", "no");
            var root        = doc.DocumentElement;

            doc.InsertBefore(declaration, root);
            var run = doc.CreateElement(string.Empty, "test-run", string.Empty);

            run.SetAttribute("id", "2"); // Hardcoded for NUnit tests
            run.SetAttribute("name", RunName);
            run.SetAttribute("testcasecount", TestCaseCount.ToString());
            run.SetAttribute("result", Result.ToString());
            run.SetAttribute("time", ((double)((DateTime.Now - StartTime).TotalMilliseconds) / 1000.0).ToString("0.000"));
            run.SetAttribute("total", Total.ToString());
            run.SetAttribute("passed", Passed.ToString());
            run.SetAttribute("failed", Failed.ToString());
            run.SetAttribute("inconclusive", Inconclusive.ToString());
            run.SetAttribute("skipped", Skipped.ToString());
            run.SetAttribute("asserts", "0");
            run.SetAttribute("run-date", StartTime.ToString("yyyy-MM-dd"));
            run.SetAttribute("start-time", StartTime.ToString("hh:mm:ss"));

            doc.AppendChild(run);


            var env = doc.CreateElement(string.Empty, "environment", string.Empty);

            env.SetAttribute("nunit-version", "1.0.0.0");
            run.AppendChild(env);

            foreach (var testSuite in TestSuites.Values)
            {
                var suite = doc.CreateElement(string.Empty, "test-suite", string.Empty);
                suite.SetAttribute("type", "TestSuite");
                suite.SetAttribute("id", testSuite.Id.ToString());
                suite.SetAttribute("name", testSuite.Name);
                suite.SetAttribute("testcasecount", testSuite.TestCaseCount.ToString());
                suite.SetAttribute("total", testSuite.Total.ToString());
                suite.SetAttribute("result", testSuite.Result.ToString());
                suite.SetAttribute("time", ((double)((testSuite.EndTime - testSuite.StartTime).TotalMilliseconds) / 1000.0).ToString("0.000"));
                suite.SetAttribute("passed", testSuite.Passed.ToString());
                suite.SetAttribute("failed", testSuite.Failed.ToString());
                suite.SetAttribute("inconclusive", testSuite.Inconclusive.ToString());
                suite.SetAttribute("skipped", testSuite.Skipped.ToString());
                suite.SetAttribute("asserts", "0");

                run.AppendChild(suite);

                foreach (var testCase in testSuite.TestCases)
                {
                    var tc = doc.CreateElement(string.Empty, "test-case", string.Empty);
                    tc.SetAttribute("id", testCase.Id.ToString());
                    tc.SetAttribute("name", testCase.Name);
                    tc.SetAttribute("result", testCase.Result.ToString());
                    tc.SetAttribute("time", "0.000");
                    tc.SetAttribute("asserts", "0");

                    suite.AppendChild(tc);

                    if (testCase.Properties != null && testCase.Properties.Count > 0)
                    {
                        var props = doc.CreateElement(string.Empty, "properties", string.Empty);
                        tc.AppendChild(props);
                        foreach (var property in testCase.Properties)
                        {
                            var prop = doc.CreateElement(string.Empty, "property", string.Empty);
                            prop.SetAttribute("name", property.Key);
                            prop.SetAttribute("value", property.Value);
                            props.AppendChild(prop);
                        }
                    }

                    if (testCase.Failure != null)
                    {
                        var failure = doc.CreateElement(string.Empty, "failure", string.Empty);
                        tc.AppendChild(failure);
                        if (testCase.Failure.Message != null)
                        {
                            var msg     = doc.CreateElement(string.Empty, "message", string.Empty);
                            var msgData = doc.CreateCDataSection(testCase.Failure.Message);
                            msg.AppendChild(msgData);
                            failure.AppendChild(msg);
                        }
                        if (testCase.Failure.StackTrace != null)
                        {
                            var stck     = doc.CreateElement(string.Empty, "stack-trace", string.Empty);
                            var stckData = doc.CreateCDataSection(testCase.Failure.StackTrace);
                            stck.AppendChild(stckData);
                            failure.AppendChild(stck);
                        }
                    }
                }
            }

            doc.Save(xmlFile);
        }
Пример #10
0
 private void Skip()
 {
     Skipped?.Invoke(this, EventArgs.Empty);
 }