示例#1
0
        public void GenerateResultsFile_Type3_Test()
        {
            // Act
            var success = VisualizeDiffs.TryGenerateResultsFile(type3, out var filePath, false);

            // Assert
            Assert.IsTrue(success);
        }
示例#2
0
        public void SplitCodeNewlines_Type3_Test()
        {
            foreach (var duplicate in type3)
            {
                // Arrange
                var code = duplicate.Code;

                // Act
                var result = VisualizeDiffs.SplitCodeNewlines(code);

                // Assert
                Assert.IsTrue(result.Count > 0);
            }
        }
 /// <summary>
 /// Event handler for the cell content click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     if (e.ColumnIndex == 4)
     {
         var cmcdResult = currentSessionResults[e.RowIndex];
         var results    = new List <DuplicateInstance>()
         {
             new DuplicateInstance(cmcdResult.MethodA),
             new DuplicateInstance(cmcdResult.MethodB),
         };
         VisualizeDiffs.TryGenerateResultsFile(results, out var resultsFilePath, false);
         Process.Start(resultsFilePath);
     }
     Cursor = Cursors.Arrow;
 }
示例#4
0
        public void GenerateCodeHTML_Type3_Test()
        {
            // Arrange
            var copy = new List <DuplicateInstance>();

            foreach (var instance in type3)
            {
                copy.Add(instance.Copy());
            }

            // Act
            VisualizeDiffs.GenerateCodeHTML(copy);

            // Assert
            for (int i = 0; i < type3.Count; i++)
            {
                var expected = type3[i].CodeHtml.Trim();
                var actual   = copy[i].CodeHtml.Trim();
                Assert.AreEqual(expected, actual, $"Instance {i} failed");
            }
        }