internal SafeContainer( ITypeIdGenerator typeIdGenerator, IInstanceProviderFactory instanceFactory, IInstanceValidator instanceValidator, ISafeObjectFactory safeObjectFactory, SafeContainerProtectionMode protectionMode = Defaults.ContainerProtectionMode, InjectionAlertChannel alertChannel = Defaults.AlertChannel) : base(protectionMode) { if (typeIdGenerator == null) { throw new ArgumentNullException(nameof(typeIdGenerator)); } if (instanceFactory == null) { throw new ArgumentNullException(nameof(instanceFactory)); } if (instanceValidator == null) { throw new ArgumentNullException(nameof(instanceValidator)); } if (safeObjectFactory == null) { throw new ArgumentNullException(nameof(safeObjectFactory)); } _typeIdGenerator = typeIdGenerator; _instanceFactory = instanceFactory; _instanceValidator = instanceValidator; _safeObjectFactory = safeObjectFactory; _alertChannel = alertChannel; ChangeProtectionMode(new ProtectionChangeContext <SafeContainerProtectionMode>(protectionMode)); SetAlertChannelInternal(alertChannel); }
internal MemoryCachedSafeByteFactory(IByteIdGenerator byteIdGenerator, IFactory <ISafeByte> safeByteFactory, ISafeObjectFactory safeObjectFactory, SafeObjectProtectionMode protectionMode) { _byteIdGenerator = byteIdGenerator ?? throw new ArgumentNullException(nameof(byteIdGenerator)); _safeByteFactory = safeByteFactory ?? throw new ArgumentNullException(nameof(safeByteFactory)); _safeObjectFactory = safeObjectFactory; _innerDictionaryProtectionMode = protectionMode; }
private static ISafeByteFactory GetSut( SafeObjectProtectionMode innerDictionaryProtectionMode = MemoryCachedSafeByteFactory.DefaultInnerDictionaryProtection, ISafeObjectFactory factory = null, IByteIdGenerator byteIdGenerator = null) { return(new MemoryCachedSafeByteFactory( byteIdGenerator ?? Stubs.Get <IByteIdGenerator>(), Stubs.GetFactory <ISafeByte>(), factory ?? Stubs.Get <ISafeObjectFactory>(), innerDictionaryProtectionMode )); }
private static ISafeContainer GetSut( SafeContainerProtectionMode protectionMode = SafeContainerProtectionMode.FullProtection , IInstanceProviderFactory providerFactory = null, IInstanceValidator instanceValidator = null, ISafeObjectFactory safeObjectFactory = null, InjectionAlertChannel alertChannel = Defaults.AlertChannel ) { return(new SafeContainer( Stubs.Get <ITypeIdGenerator>(), providerFactory ?? Stubs.Get <IInstanceProviderFactory>(), instanceValidator ?? Stubs.Get <IInstanceValidator>(), safeObjectFactory ?? Stubs.Get <ISafeObjectFactory>(), protectionMode, alertChannel )); }