This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chkeita/watson
- Loading branch information
Showing
15 changed files
with
278 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,7 @@ public async Async.Task CannotCreateVMForMissingReport() { | |
null, | ||
null, | ||
null, | ||
null, | ||
null | ||
); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,7 @@ private static Report GetReport() { | |
null, | ||
null, | ||
null, | ||
null, | ||
null | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using FluentAssertions; | ||
using Microsoft.OneFuzz.Service; | ||
using Xunit; | ||
|
||
namespace Tests; | ||
|
||
public class TruncationTests { | ||
[Fact] | ||
public static void ReportIsTruncatable() { | ||
var report = GenerateReport(); | ||
|
||
var truncatedReport = report.Truncate(5); | ||
|
||
truncatedReport.Executable.Should().Be("SOMES"); | ||
truncatedReport.CallStack.Count.Should().Be(0); | ||
} | ||
|
||
[Fact] | ||
public static void TestListTruncation() { | ||
var testList = new List<string> { | ||
"1", "2", "3", "456" | ||
}; | ||
|
||
var truncatedList = TruncateUtils.TruncateList(testList, 3); | ||
truncatedList.Count.Should().Be(3); | ||
truncatedList.Should().BeEquivalentTo(new[] { "1", "2", "3" }); | ||
} | ||
|
||
[Fact] | ||
public static void TestNestedTruncation() { | ||
var eventCrashReported = new EventCrashReported( | ||
GenerateReport(), | ||
Container.Parse("123"), | ||
"abc", | ||
null | ||
); | ||
|
||
var truncatedEvent = eventCrashReported.Truncate(3) as EventCrashReported; | ||
truncatedEvent.Should().NotBeNull(); | ||
truncatedEvent?.Report.Executable.Should().Be("SOM"); | ||
truncatedEvent?.Report.CallStack.Count.Should().Be(0); | ||
} | ||
|
||
private static Report GenerateReport() { | ||
return new Report( | ||
null, | ||
null, | ||
"SOMESUPRTLONGSTRINGSOMESUPRTLONGSTRINGSOMESUPRTLONGSTRINGSOMESUPRTLONGSTRING", | ||
"abc", | ||
"abc", | ||
new List<string> { "SOMESUPRTLONGSTRINGSOMESUPRTLONGSTRING" }, | ||
"abc", | ||
"abc", | ||
null, | ||
Guid.Empty, | ||
Guid.Empty, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
null, | ||
new Uri("http://example.com") | ||
); | ||
} | ||
} |
Oops, something went wrong.