public void ThrowIfInvalidFileterTypeAllWith_fileterTypesにデフォルトコンストラクターがない型が含まれる場合はfalseが返る() { Action act = () => FilterSupport.ThrowIfInvalidFilterTypeAllWith( new Type[] { typeof(Filter1), typeof(Filter3), typeof(Filter2) }); act.Should().Throw <ArgumentException>(); }
public AsServiceAttribute(string path, params Type[] filterTypes) { if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException(SR.Argument_CanNotNullOrWhitespace(nameof(path))); } Path = path; if (filterTypes is null) { throw new ArgumentNullException(nameof(filterTypes)); } FilterSupport.ThrowIfInvalidFilterTypeAllWith(filterTypes); FilterTypes = new ReadOnlyCollection <Type>(filterTypes); }
public static IEnumerable <MediatorServiceDescription> Create(Type serviceType, params Type[] filterTypes) { if (serviceType is null) { throw new ArgumentNullException(nameof(serviceType)); } FilterSupport.ThrowIfInvalidFilterTypeAllWith(filterTypes); if (!CanServicalize(serviceType)) { throw new ArgumentException(SR.Argument_CanNotServicalize(nameof(serviceType))); } var attrs = serviceType.GetAttributes <AsServiceAttribute>(true); return(attrs.Select(attr => { var attrFilters = attr.FilterTypes; var filters = filterTypes.Concat(attrFilters).ToList(); return new MediatorServiceDescription(attr.Path, serviceType, filters); }).ToList()); }
public void ThrowIfInvalidFileterTypeAllWith_fileterTypesが全てIFilterを継承してデフォルトコンストラクターがある型の場合はtrueが返る() { FilterSupport.ThrowIfInvalidFilterTypeAllWith( new Type[] { typeof(Filter1), typeof(Filter2) }); }
public void ThrowIfInvalidFileterTypeAllWith_fileterTypesがnullの場合は例外が発生する() { Action act = () => FilterSupport.ThrowIfInvalidFilterTypeAllWith(null); act.Should().Throw <ArgumentNullException>(); }