2022-01-21 15:36:25 +01:00
|
|
|
|
using System.Text.Json;
|
2020-12-08 02:35:34 +01:00
|
|
|
|
using Bit.Core.Test.AutoFixture.CipherFixtures;
|
2023-03-02 19:23:38 +01:00
|
|
|
|
using Bit.Core.Vault.Entities;
|
2022-08-31 15:38:35 +02:00
|
|
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
2020-12-08 02:35:34 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
2021-05-13 23:14:56 +02:00
|
|
|
|
namespace Bit.Core.Test.Models;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2021-05-13 23:14:56 +02:00
|
|
|
|
public class CipherTests
|
2020-12-08 02:35:34 +01:00
|
|
|
|
{
|
2022-08-29 22:06:55 +02:00
|
|
|
|
[Theory]
|
2022-08-31 15:38:35 +02:00
|
|
|
|
[UserCipherCustomize]
|
|
|
|
|
[BitAutoData]
|
|
|
|
|
public void Clone_UserCipher_CreatesExactCopy(Cipher cipher)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(JsonSerializer.Serialize(cipher), JsonSerializer.Serialize(cipher.Clone()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[OrganizationCipherCustomize]
|
|
|
|
|
[BitAutoData]
|
|
|
|
|
public void Clone_OrganizationCipher_CreatesExactCopy(Cipher cipher)
|
2020-12-08 02:35:34 +01:00
|
|
|
|
{
|
2022-01-21 15:36:25 +01:00
|
|
|
|
Assert.Equal(JsonSerializer.Serialize(cipher), JsonSerializer.Serialize(cipher.Clone()));
|
2020-12-08 02:35:34 +01:00
|
|
|
|
}
|
|
|
|
|
}
|