-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add binlog serialization for BuildCanceledEventArgs, (#10755)
fix typo in other test class, add tests
- Loading branch information
1 parent
8cd45e3
commit 97dc045
Showing
9 changed files
with
89 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace Microsoft.Build.Framework.UnitTests | ||
{ | ||
public class BuildCanceledEventArgs_Tests | ||
{ | ||
[Fact] | ||
public void SerializationDeserializationTest() | ||
{ | ||
var message = "message"; | ||
var datetime = DateTime.Today; | ||
|
||
BuildCanceledEventArgs args = new( | ||
message, | ||
datetime | ||
); | ||
using MemoryStream stream = new MemoryStream(); | ||
using BinaryWriter bw = new BinaryWriter(stream); | ||
args.WriteToStream(bw); | ||
|
||
stream.Position = 0; | ||
using BinaryReader br = new BinaryReader(stream); | ||
BuildCanceledEventArgs argDeserialized = new("m"); | ||
int packetVersion = (Environment.Version.Major * 10) + Environment.Version.Minor; | ||
|
||
argDeserialized.CreateFromStream(br, packetVersion); | ||
argDeserialized.Message.ShouldBe(message); | ||
argDeserialized.Timestamp.ShouldBe(datetime); | ||
} | ||
} | ||
} |
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