1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00
bitwarden-server/test/Core.Test/AutoFixture/CipherAttachmentMetaDataFixtures.cs
Justin Baur 5268f2781e
Start Migration from Newtonsoft.Json to System.Text.Json (#1803)
* Start switch to System.Text.Json

* Work on switching to System.Text.Json

* Main work on STJ refactor

* Fix build errors

* Run formatting

* Delete unused file

* Use legacy for two factor providers

* Run formatter

* Add TokenProviderTests

* Run formatting

* Fix merge issues

* Switch to use JsonSerializer

* Address PR feedback

* Fix formatting

* Ran formatter

* Switch to async

* Ensure Enums are serialized as strings

* Fix formatting

* Enqueue single items as arrays

* Remove CreateAsync method on AzureQueueService
2022-01-21 09:36:25 -05:00

34 lines
1.3 KiB
C#

using AutoFixture;
using AutoFixture.Dsl;
using Bit.Core.Models.Data;
namespace Bit.Core.Test.AutoFixture.CipherAttachmentMetaData
{
public class MetaData : ICustomization
{
protected virtual IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
ICustomizationComposer<CipherAttachment.MetaData> composer)
{
return composer.With(d => d.Size, fixture.Create<long>());
}
public void Customize(IFixture fixture)
{
fixture.Customize<CipherAttachment.MetaData>(composer => ComposerAction(fixture, composer));
}
}
public class MetaDataWithoutContainer : MetaData
{
protected override IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
ICustomizationComposer<CipherAttachment.MetaData> composer) =>
base.ComposerAction(fixture, composer).With(d => d.ContainerName, (string)null);
}
public class MetaDataWithoutKey : MetaDataWithoutContainer
{
protected override IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
ICustomizationComposer<CipherAttachment.MetaData> composer) =>
base.ComposerAction(fixture, composer).Without(d => d.Key);
}
}