2021-04-02 12:28:27 +00:00
|
|
|
using System;
|
|
|
|
|
using AutoFixture.Kernel;
|
|
|
|
|
using Elsa.Testing.Shared.AutoFixture.SpecimenBuilders;
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Testing.Shared.AutoFixture.Specifications
|
|
|
|
|
{
|
|
|
|
|
public class IsInstanceOf : IRequestSpecification
|
|
|
|
|
{
|
2021-09-16 18:26:18 +00:00
|
|
|
readonly Type _type;
|
2021-04-02 12:28:27 +00:00
|
|
|
|
2021-09-16 18:26:18 +00:00
|
|
|
public bool IsSatisfiedBy(object request) => request.IsAnAutofixtureRequestForType(_type);
|
2021-04-02 12:28:27 +00:00
|
|
|
|
|
|
|
|
public IsInstanceOf(Type type)
|
|
|
|
|
{
|
2021-09-16 18:26:18 +00:00
|
|
|
_type = type ?? throw new ArgumentNullException(nameof(type));
|
2021-04-02 12:28:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IsInstanceOf Type<T>() => new IsInstanceOf(typeof(T));
|
|
|
|
|
}
|
|
|
|
|
}
|