public void PushCommitsTest()
        {
            string username = ""; // commented out for commiting folder up
            // auth code in username
            // need to be removed whenever committing to github
            ////
            // when running commit test, change values in actual file to not require bug ticket info!!!
            ////

            string password    = string.Empty;
            String gitRepoUrl  = "https://github.com/SohaibHN/Test.git";
            String localFolder = "C:\\Users\\Admin\\source\\repos\\Test";
            string path        = Directory.GetCurrentDirectory();

            localFolder = Path.GetFullPath(Path.Combine(path, @"..\..\..\..\Test"));
            var BugDetails = new BugDetails();

            var folder = new DirectoryInfo(localFolder);

            BugDetails.GitDeploy2(username, password, gitRepoUrl, localFolder);
            BugDetails.CommitAllChanges();


            Assert.IsTrue(BugDetails.PushCommits("origin", "master"), "Unable to Push Commit");
        }
Esempio n. 2
0
        public EditBugDetailsForm(VSOOutput output)
        {
            Options = new BugDetails();
            InitializeComponent();

            if (string.IsNullOrEmpty(output.BuildDefinitionName))
            {
                lbBuilds.Hide();
                lblBuild.Hide();
            }
            else
            {
                GetBuilds(output);
            }
        }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            String class_name  = txt_class.Text;
            String method      = txt_method.Text;
            String line        = txt_line.Text;
            int    linee       = int.Parse(line);
            String path        = txt_path.Text;
            String symptom     = txt_sym.Text;
            String cause       = txt_cause.Text;
            String img_desc    = txt_name.Text;
            String code_block  = FastColour.Text;
            String source_link = txt_link.Text;

            if (String.IsNullOrEmpty(class_name))
            {
                MessageBox.Show("Please Provide Valid Information");
            }
            else if (String.IsNullOrEmpty(method))
            {
                MessageBox.Show("Please Provide Valid mathod name");
            }
            else if (String.IsNullOrEmpty(symptom))
            {
                MessageBox.Show("Please Provide Valid Symptom");
            }
            else if (String.IsNullOrEmpty(cause))
            {
                MessageBox.Show("Please Provide Valid Cause");
            }
            else if (String.IsNullOrEmpty(path))
            {
                MessageBox.Show("Please Provide Valid Path");
            }
            else if (String.IsNullOrEmpty(img_desc))
            {
                MessageBox.Show("Please Provide Valid Image Description");
            }
            else if (program_id == 0)
            {
                MessageBox.Show("Please Select program from Table");
            }
            else if (String.IsNullOrEmpty(source_link))
            {
                MessageBox.Show("Please Provide Valid Source Link");
            }
            else if (String.IsNullOrEmpty(code_block))
            {
                MessageBox.Show("Please Provide Error Code");
            }

            else
            {
                Bug bug = new Bug()
                {
                    program     = program_id,
                    class_name  = class_name,
                    method_name = method,
                    line_number = linee,
                    found_by    = id
                };
                BugDAO bu = new BugDAO();
                bug_id = bu.Insert(bug);
                Console.WriteLine(bug_id);

                BugDetails bugd = new BugDetails()
                {
                    bug_id      = bug_id,
                    image       = imgdata,
                    symptom     = symptom,
                    cause       = cause,
                    image_name  = img_desc,
                    code_block  = code_block,
                    source_link = source_link
                };
                BugDetailsDAO db = new BugDetailsDAO();

                int done = db.Insert(bugd);
                if (done != 0 && bug_id != 0)
                {
                    MessageBox.Show("inserted");
                    ClearFields();
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new bugitem with the given <paramref name="details"/> and the <paramref name="pictureOfBug"/> in the repro steps
        /// </summary>
        public async Task CreateBug(BugDetails details, ImageData pictureOfBug)
        {
            const string        urlEncodedFilename = "bug-shooter-screenshot.jpeg";
            var                 bitmap             = (Bitmap)pictureOfBug.MergedImage;
            AttachmentReference attachment;

            using (var stream = ConvertBitmapToMaxQualityJpeg(bitmap))
            {
                attachment = await _workItemClient.CreateAttachmentAsync(stream, urlEncodedFilename, uploadType : "Simple",
                                                                         areaPath : null, userState : null, cancellationToken : default);
            }

            string reproAsHtml = details.ReproSteps.Replace("\n", "<br />");

            JsonPatchDocument doc = new JsonPatchDocument
            {
                new JsonPatchOperation
                {
                    Path      = TitleFieldPath,
                    Operation = Operation.Add,
                    Value     = details.Title
                },
                new JsonPatchOperation
                {
                    Path      = ReproStepsFieldPath,
                    Operation = Operation.Add,
                    Value     = $"{reproAsHtml}<br /><img src='{attachment.Url}' />"
                },
                new JsonPatchOperation
                {
                    Path      = RelationFieldPath,
                    Operation = Operation.Add,
                    Value     = new
                    {
                        rel = "AttachedFile",
                        url = attachment.Url
                    }
                }
            };

            if (!string.IsNullOrWhiteSpace(_output.IterationName))
            {
                doc.Add(new JsonPatchOperation
                {
                    Path      = IterationFieldPath,
                    Operation = Operation.Add,
                    Value     = _output.IterationName
                });
            }

            if (!string.IsNullOrEmpty(_output.BuildDefinitionName) && !string.IsNullOrEmpty(details.Build))
            {
                doc.Add(new JsonPatchOperation
                {
                    Path      = FoundInBuildFieldPath,
                    Operation = Operation.Add,
                    Value     = $"{details.Build}"
                });
            }

            await _workItemClient.CreateWorkItemAsync(doc, _output.ProjectName, WorkItemType);
        }
    static void Main(string[] args)
    {
        var MyBugList = new BugDetails[]
        {
            new BugDetails()
            {
                Id = 1, State = "Active", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Resolved", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Resolved", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Resolved", Severity = "Critical"
            },
            new BugDetails()
            {
                Id = 1, State = "Active", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Active", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Resolved", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Resolved", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Resolved", Severity = "Medium"
            },
            new BugDetails()
            {
                Id = 1, State = "Active", Severity = "High"
            },
            new BugDetails()
            {
                Id = 1, State = "Active", Severity = "High"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "High"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "High"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "High"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "High"
            },
            new BugDetails()
            {
                Id = 1, State = "Closed", Severity = "High"
            },
        };
        var grouped = MyBugList.GroupBy(b => b.State).
                      Select(stateGrp => stateGrp.GroupBy(b => b.Severity));

        foreach (var state in grouped)
        {
            Console.Write("{0}: ", state.First().First().State);
            foreach (var severity in state)
            {
                Console.Write("{0}={1} ", severity.Key, severity.Count());
            }
            Console.WriteLine();
        }
    }