public ParticipantStub( ITypeIdentifierProvider typeIdentifierProvider, Action <object, IProxyTypeAssemblyContext> participateAction, Func <Type, object> getAdditionalTypeIDFunc, Action <Type> handleNonSubclassableTypeAction, Func <object, IAdditionalTypeAssemblyContext, Type> getOrCreateAdditionalTypeFunc) { // Type identifier provider may be null. if (participateAction == null) { throw new ArgumentNullException("participateAction"); } if (getAdditionalTypeIDFunc == null) { throw new ArgumentNullException("getAdditionalTypeIDFunc"); } if (handleNonSubclassableTypeAction == null) { throw new ArgumentNullException("handleNonSubclassableTypeAction"); } if (getOrCreateAdditionalTypeFunc == null) { throw new ArgumentNullException("getOrCreateAdditionalTypeFunc"); } _typeIdentifierProvider = typeIdentifierProvider; _participateAction = participateAction; _getAdditionalTypeIDFunc = getAdditionalTypeIDFunc; _handleNonSubclassableTypeAction = handleNonSubclassableTypeAction; _getOrCreateAdditionalTypeFunc = getOrCreateAdditionalTypeFunc; }
public void SetUp() { _participantWithoutIdentifierProvider = MockRepository.GenerateStub <IParticipant>(); _participantWithIdentifierProvider = MockRepository.GenerateStub <IParticipant>(); _identifierProviderMock = MockRepository.GenerateMock <ITypeIdentifierProvider>(); _participantWithIdentifierProvider.Stub(_ => _.PartialTypeIdentifierProvider).Return(_identifierProviderMock); _provider = new AssembledTypeIdentifierProvider(new[] { _participantWithoutIdentifierProvider, _participantWithIdentifierProvider }.AsOneTime()); }
protected static IParticipant CreateParticipant( Action <object, IProxyTypeAssemblyContext> participateAction = null, ITypeIdentifierProvider typeIdentifierProvider = null, Func <Type, object> getAdditionalTypeIDFunc = null, Func <object, IAdditionalTypeAssemblyContext, Type> additionalTypeFunc = null, Action <Type> handleNonSubclassableTypeAction = null) { participateAction = participateAction ?? ((id, ctx) => { }); getAdditionalTypeIDFunc = getAdditionalTypeIDFunc ?? (ctx => null); handleNonSubclassableTypeAction = handleNonSubclassableTypeAction ?? (ctx => { }); additionalTypeFunc = additionalTypeFunc ?? ((id, ctx) => null); // Avoid no-modification optimization. participateAction = CreateModifyingAction(participateAction); return(new ParticipantStub(typeIdentifierProvider, participateAction, getAdditionalTypeIDFunc, handleNonSubclassableTypeAction, additionalTypeFunc)); }