1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 09:02:48 -05:00

Feature/bit auto data (#2219)

* Update ProviderService tests

* Use BitAutoData in CipherService tests

* Simplify UserCipher fixture

Because we use a single customizer for all ciphers, they all have the same userId.

* Clean up more cipher fixtures

* Swap Cipher Fixtures to BitCustomizeAttribute

* Clean up collection fixtures

* Clean up GroupFixtures

* Move SendService Tests to BitAutoData

* Clean up Organization Fixtures

TODO: The customize attributes should not be customizing more than one class

* Name files after the class they contain

* Clear up usage of CustomAutoDataAttribute in tests

* Clean up usages of InlineCustomAutoData

* format

* Manually merge with file-scoped-namespace changes
This commit is contained in:
Matt Gibson
2022-08-31 07:38:35 -06:00
committed by GitHub
parent 2d9d6ad812
commit a6d97118fa
28 changed files with 423 additions and 484 deletions

View File

@ -1,6 +1,7 @@
using System.Text.Json;
using Bit.Core.Entities;
using Bit.Core.Test.AutoFixture.CipherFixtures;
using Bit.Test.Common.AutoFixture.Attributes;
using Xunit;
namespace Bit.Core.Test.Models;
@ -8,9 +9,17 @@ namespace Bit.Core.Test.Models;
public class CipherTests
{
[Theory]
[InlineUserCipherAutoData]
[InlineOrganizationCipherAutoData]
public void Clone_CreatesExactCopy(Cipher cipher)
[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)
{
Assert.Equal(JsonSerializer.Serialize(cipher), JsonSerializer.Serialize(cipher.Clone()));
}