2022-01-21 15:36:25 +01:00
|
|
|
|
using System.Text.Json;
|
2023-04-18 14:05:17 +02:00
|
|
|
|
using Bit.Core.Tools.Models.Data;
|
2022-01-21 15:36:25 +01:00
|
|
|
|
using Bit.Test.Common.Helpers;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
2023-04-18 14:05:17 +02:00
|
|
|
|
namespace Bit.Core.Test.Tools.Models.Data;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2022-01-21 15:36:25 +01:00
|
|
|
|
public class SendFileDataTests
|
|
|
|
|
{
|
2022-08-29 22:06:55 +02:00
|
|
|
|
[Fact]
|
2022-01-21 15:36:25 +01:00
|
|
|
|
public void Serialize_Success()
|
|
|
|
|
{
|
|
|
|
|
var sut = new SendFileData
|
|
|
|
|
{
|
|
|
|
|
Id = "test",
|
|
|
|
|
Size = 100,
|
|
|
|
|
FileName = "thing.pdf",
|
|
|
|
|
Validated = true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var json = JsonSerializer.Serialize(sut);
|
|
|
|
|
var document = JsonDocument.Parse(json);
|
|
|
|
|
var root = document.RootElement;
|
|
|
|
|
AssertHelper.AssertJsonProperty(root, "Size", JsonValueKind.String);
|
|
|
|
|
Assert.False(root.TryGetProperty("SizeString", out _));
|
|
|
|
|
}
|
|
|
|
|
}
|