elsa-core/test/shared/Elsa.Testing.Shared/AutoFixture/Specifications/IsInstanceOf.cs

20 lines
565 B
C#
Raw Normal View History

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-09-16 18:26:18 +00:00
public bool IsSatisfiedBy(object request) => request.IsAnAutofixtureRequestForType(_type);
public IsInstanceOf(Type type)
{
2021-09-16 18:26:18 +00:00
_type = type ?? throw new ArgumentNullException(nameof(type));
}
public static IsInstanceOf Type<T>() => new IsInstanceOf(typeof(T));
}
}