This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OmitInitOnlyRecordProperties : ICustomization | |
{ | |
public void Customize(IFixture fixture) | |
{ | |
fixture.Customizations.Insert(0, new Omitter(new ExtenalInitPropertySpecification())); | |
} | |
private class ExtenalInitPropertySpecification : IRequestSpecification | |
{ | |
public bool IsSatisfiedBy(object request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RandomRelayCustomization : ISpecimenBuilder | |
{ | |
private readonly List<ISpecimenBuilder> builders; | |
private readonly IEnumerator<int> randomizer; | |
public RandomRelayCustomization(params ISpecimenBuilder[] builders) | |
: this(builders.AsEnumerable()) | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class FreezingBehavior : ISpecimenBuilderTransformation | |
{ | |
public FreezingBehavior(IRequestSpecification specification) | |
{ | |
this.specification = specification ?? throw new ArgumentNullException(nameof(specification)); | |
} | |
public ISpecimenBuilderNode Transform(ISpecimenBuilder builder) | |
{ | |
return new FreezingNode(builder, specification); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConfigurableMockPostprocessor : ISpecimenBuilder | |
{ | |
public ConfigurableMockPostprocessor(ISpecimenBuilder builder) | |
{ | |
this.Builder = builder ?? throw new ArgumentNullException(nameof(builder)); | |
} | |
public ISpecimenBuilder Builder { get; set; } | |
public object Create(object request, ISpecimenContext context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AutoFixture.Dsl; | |
using AutoFixture.Kernel; | |
using AutoFixture.Xunit2; | |
using System; | |
using System.Reflection; | |
using Xunit; | |
namespace AutoFixture.Issue1302 | |
{ | |
public class ParameterDecoratorTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExactPropertyCriterion : IEquatable<PropertyInfo> | |
{ | |
private readonly PropertyInfo propertyInfo; | |
public ExactPropertyCriterion(PropertyInfo propertyInfo) | |
{ | |
this.propertyInfo = propertyInfo; | |
} | |
public bool Equals(PropertyInfo other) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Order | |
{ | |
public decimal TaxPercent { get; set; } | |
public decimal DiscountPercent { get; set; } | |
} | |
public class ChristmasOrderTax : IPartialPostprocessComposer<Order> | |
{ | |
public IPostprocessComposer<Order> Compose(IPostprocessComposer<Order> composer) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CombinatorialNames : IEnumerable<FullName> | |
{ | |
private readonly IEnumerable<FullName> names; | |
public CombinatorialNames(IEnumerable<string> firstNames, IEnumerable<string> lastNames) | |
{ | |
names = | |
from firstName in firstNames | |
from lastName in lastNames | |
select new FullName(firstName, lastName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace AutoFixture | |
{ | |
public interface IDepthHandler | |
{ | |
object Handle(object request, Stack<object> recordedRequests); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RandomFromFixedSequence<T> : ICustomization | |
{ | |
private IEnumerator<int> randomizer; | |
private List<T> sequence; | |
public void Customize(IFixture fixture) | |
{ | |
this.sequence = fixture.CreateMany<T>().ToList(); | |
this.randomizer = new RoundRobinSequence(0, sequence.Count - 1).GetEnumerator(); | |
fixture.Register(PickRandomItemFromSequence); |
NewerOlder