2021-02-22 22:35:16 +01:00
|
|
|
|
using AutoFixture;
|
|
|
|
|
using AutoFixture.Dsl;
|
|
|
|
|
using Bit.Core.Models.Data;
|
|
|
|
|
|
2022-08-29 21:53:48 +02:00
|
|
|
|
namespace Bit.Core.Test.AutoFixture.CipherAttachmentMetaData
|
2021-02-22 22:35:16 +01:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02:00
|
|
|
|
public class MetaData : ICustomization
|
2021-02-22 22:35:16 +01:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02:00
|
|
|
|
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));
|
|
|
|
|
}
|
2021-02-22 22:35:16 +01:00
|
|
|
|
}
|
2022-08-29 21:53:48 +02:00
|
|
|
|
|
|
|
|
|
public class MetaDataWithoutContainer : MetaData
|
2021-02-22 22:35:16 +01:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02:00
|
|
|
|
protected override IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
|
|
|
|
|
ICustomizationComposer<CipherAttachment.MetaData> composer) =>
|
|
|
|
|
base.ComposerAction(fixture, composer).With(d => d.ContainerName, (string)null);
|
2021-02-22 22:35:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
2022-08-29 21:53:48 +02:00
|
|
|
|
public class MetaDataWithoutKey : MetaDataWithoutContainer
|
|
|
|
|
{
|
|
|
|
|
protected override IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
|
|
|
|
|
ICustomizationComposer<CipherAttachment.MetaData> composer) =>
|
|
|
|
|
base.ComposerAction(fixture, composer).Without(d => d.Key);
|
|
|
|
|
}
|
2021-02-22 22:35:16 +01:00
|
|
|
|
}
|