This now also includes reworking the attribute which activates Autofixture-style resolution upon an IServiceProvider. This has now been renamed to WithAutofixtureResolutionAttribute. The new/reworked attribute is composable with other Autofixture attributes.
20 lines
567 B
C#
20 lines
567 B
C#
using System;
|
|
using AutoFixture.Kernel;
|
|
using Elsa.Testing.Shared.AutoFixture.SpecimenBuilders;
|
|
|
|
namespace Elsa.Testing.Shared.AutoFixture.Specifications
|
|
{
|
|
public class IsInstanceOf : IRequestSpecification
|
|
{
|
|
readonly Type type;
|
|
|
|
public bool IsSatisfiedBy(object request) => request.IsAnAutofixtureRequestForType(type);
|
|
|
|
public IsInstanceOf(Type type)
|
|
{
|
|
this.type = type ?? throw new ArgumentNullException(nameof(type));
|
|
}
|
|
|
|
public static IsInstanceOf Type<T>() => new IsInstanceOf(typeof(T));
|
|
}
|
|
} |