Skip to content

Commit 0cd40d2

Browse files
NH-4028 - fixed a duplicated test, more strict logic for supporting dups, slightly better comparison ordering.
1 parent 2c8c5c5 commit 0cd40d2

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

src/NHibernate.Test/Linq/WhereTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ private static List<object[]> CanUseCompareInQueryDataSource()
831831

832832
// Over floats.
833833
TestRow(p => p.ShippingWeight.CompareTo((float) 4.98) <= 0, 17, false),
834-
TestRow(p => p.ShippingWeight.CompareTo((float) 4.98) <= 0, 17, false),
835834

836835
// Over nullable decimals.
837836
TestRow(p => p.UnitPrice.Value.CompareTo((decimal) 14.00) <= 0, 24, false),

teamcity.build

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,28 @@
362362
{
363363
try
364364
{
365-
var outputFile = Path.GetDirectoryName(currentResult) + "/Comparison.txt";
365+
var outputFile = Path.Combine(Path.GetDirectoryName(currentResult), @"Comparison.txt");
366366
var report = new StringBuilder();
367367
368368
report.AppendLine("Comparison Results");
369369
report.AppendLine("==================");
370370
371371
var before = Result.ParseFile(lastResult);
372-
var beforeByName = before.GroupBy(b => b.Name).ToDictionary(g => g.Key, g => g.First());
372+
var beforeByName = before
373+
// Some multi-value tests may be duplicated
374+
.GroupBy(b => b.Name)
375+
.ToDictionary(
376+
g => g.Key,
377+
// Take one, preferably not failing first, thus ensuring an after failing test
378+
// will be match as broken in case one of the dup was not failing.
379+
g => g
380+
// Succeeded
381+
.OrderByDescending(r => r.Success)
382+
// Else ignored
383+
.ThenBy(r => r.Executed)
384+
// Else inconclusive
385+
.ThenBy(r => r.Status == ResultStatus.Success ? 0 : 1)
386+
.First());
373387
var after = Result.ParseFile(currentResult);
374388
375389
var newFailingTests = new List<Result>();
@@ -379,8 +393,10 @@
379393
var ignoredTests = new List<Result>();
380394
var brokenTests = new List<Result>();
381395
var inconclusiveTests = new List<Result>();
396+
var afterTestNames = new HashSet<string>();
382397
foreach (var afterResult in after)
383398
{
399+
afterTestNames.Add(afterResult.Name);
384400
Result beforeResult;
385401
if (beforeByName.TryGetValue(afterResult.Name, out beforeResult))
386402
{
@@ -412,8 +428,6 @@
412428
}
413429
}
414430
415-
var afterTestNames = new HashSet<string>();
416-
foreach (var result in after) afterTestNames.Add(result.Name);
417431
var missingTests = new List<Result>();
418432
foreach (var result in before)
419433
if (!afterTestNames.Contains(result.Name))
@@ -460,30 +474,30 @@
460474
report.AppendLine("None");
461475
462476
report.AppendLine();
463-
report.AppendLine("*** Tests new (not failing) since last recorded results ***");
464-
if (newNotFailingTests.Count > 0)
477+
report.AppendLine("*** Tests fixed since last recorded results ***");
478+
if (fixedTests.Count > 0)
465479
{
466-
foreach (var result in newNotFailingTests)
480+
foreach (Result result in fixedTests)
467481
report.AppendLine(result.ToString());
468482
}
469483
else
470484
report.AppendLine("None");
471485
472486
report.AppendLine();
473-
report.AppendLine("*** Tests fixed since last recorded results ***");
474-
if (fixedTests.Count > 0)
487+
report.AppendLine("*** Tests ignored since last recorded results ***");
488+
if (ignoredTests.Count > 0)
475489
{
476-
foreach (Result result in fixedTests)
490+
foreach (Result result in ignoredTests)
477491
report.AppendLine(result.ToString());
478492
}
479493
else
480494
report.AppendLine("None");
481495
482496
report.AppendLine();
483-
report.AppendLine("*** Tests ignored since last recorded results ***");
484-
if (ignoredTests.Count > 0)
497+
report.AppendLine("*** Tests new (not failing) since last recorded results ***");
498+
if (newNotFailingTests.Count > 0)
485499
{
486-
foreach (Result result in ignoredTests)
500+
foreach (var result in newNotFailingTests)
487501
report.AppendLine(result.ToString());
488502
}
489503
else

0 commit comments

Comments
 (0)