public void ThenDefaultInstrumentationProviderRegistrationIsDefault()
 {
     instrumentationRegistration
     .AssertForServiceType(typeof(IDefaultCryptographyInstrumentationProvider))
     .ForImplementationType(typeof(DefaultCryptographyEventLogger))
     .IsDefault();
 }
Esempio n. 2
0
 public void ThenServiceTypeIsNull()
 {
     registration
     .AssertForServiceType(typeof(ExceptionPolicyImpl))
     .ForName("policy")
     .ForImplementationType(typeof(ExceptionPolicyImpl));
 }
 public void ThenRegistrationTypeAndNameAreForOracleDatabase()
 {
     registration
     .AssertForServiceType(typeof(Database))
     .ForName("myConnectionName")
     .ForImplementationType(typeof(OracleDatabase));
 }
 public void ThenRegistryMatchesServiceTypeNameAndImplementationType()
 {
     registration
     .AssertForServiceType(typeof(ILogFormatter))
     .ForName("formatterName")
     .ForImplementationType(typeof(BinaryLogFormatter));
 }
Esempio n. 5
0
 public void ThenServiceTypeIsNull()
 {
     registration
     .AssertForServiceType(typeof(ExceptionPolicyEntry))
     .ForName("prefix.name")
     .ForImplementationType(typeof(ExceptionPolicyEntry));
 }
Esempio n. 6
0
        public void ThenRegistryEntryReturnsNamedServiceEntry()
        {
            TypeRegistration registry =
                listenerData.GetRegistrations().Where(tr => tr.Name == "systemDiagnosticsTraceListener\u200Cimplementation").First();

            registry.AssertForServiceType(typeof(TraceListener))
            .ForName("systemDiagnosticsTraceListener\u200Cimplementation")
            .ForImplementationType(typeof(System.Diagnostics.TextWriterTraceListener));
        }
        public void ThenRegistrationIsForCorrectServiceAndType()
        {
            TypeRegistration registry =
                listenerData.GetRegistrations().First(tr => tr.Name == "custom trace listener\u200Cimplementation");

            registry.AssertForServiceType(typeof(TraceListener))
            .ForName("custom trace listener\u200Cimplementation")
            .ForImplementationType(typeof(MockCustomTraceListener));
        }
        public void ThenRegistrationIsForCorrectServiceAndType()
        {
            TypeRegistration registry =
                listenerData.GetRegistrations().Where(tr => tr.Name == "custom trace listener\u200Cimplementation").First();

            registry.AssertForServiceType(typeof(TraceListener))
            .ForName("custom trace listener\u200Cimplementation")
            .ForImplementationType(typeof(System.Diagnostics.TextWriterTraceListener));
        }
Esempio n. 9
0
        public void TheRegistrationForLoggingUpdateConfiguratorIsForNullName()
        {
            TypeRegistration registration = registrations.First(tr => tr.ServiceType == typeof(ILoggingUpdateCoordinator));

            registration
            .AssertForServiceType(typeof(ILoggingUpdateCoordinator))
            .IsDefault()
            .IsNotPublicName()
            .ForImplementationType(typeof(LoggingUpdateCoordinator));
        }
Esempio n. 10
0
        public void TheRegistrationForLogWriterStructureHolderIsForNullName()
        {
            TypeRegistration registration = registrations.First(tr => tr.ServiceType == typeof(LogWriterStructureHolder));

            registration
            .AssertForServiceType(typeof(LogWriterStructureHolder))
            .IsDefault()
            .IsNotPublicName()
            .ForImplementationType(typeof(LogWriterStructureHolder));
        }
Esempio n. 11
0
        public void TheRegistrationForTraceManagerIsForNullName()
        {
            TypeRegistration registration = registrations.First(tr => tr.ServiceType == typeof(TraceManager));

            registration
            .AssertForServiceType(typeof(TraceManager))
            .IsDefault()
            .IsNotPublicName()
            .ForImplementationType(typeof(TraceManager));
        }
Esempio n. 12
0
        public void TheRegistrationForLogWriterIsDefaultAndSingletonAndPublicName()
        {
            TypeRegistration registration = registrations.First(tr => tr.ServiceType == typeof(LogWriter));

            registration
            .AssertForServiceType(typeof(LogWriter))
            .IsDefault()
            .IsSingleton()
            .IsPublicName()
            .ForImplementationType(typeof(LogWriterImpl));
        }
Esempio n. 13
0
        public void WhenRegistrationsAreRequested_ThenReturnsWrapHandlerRegistrationWithCorrectName()
        {
            var registrations = settings.GetRegistrations(null);

            TypeRegistration registration = registrations.First(r => r.ImplementationType == typeof(WrapHandler));

            registration.AssertForServiceType(typeof(IExceptionHandler))
            .ForName("aPolicy.ExceptionType.aWrapHandler")
            .ForImplementationType(typeof(WrapHandler))
            .IsNotPublicName();
        }
Esempio n. 14
0
        public void WhenRegistrationsAreRequested_ThenReturnsARegistrationForExceptionPolicyEntry()
        {
            var registrations = settings.GetRegistrations(null);

            TypeRegistration registration = registrations.First(r => r.ImplementationType == typeof(ExceptionPolicyImpl));

            registration.AssertForServiceType(typeof(ExceptionPolicyImpl))
            .ForName("aPolicy")
            .ForImplementationType(typeof(ExceptionPolicyImpl))
            .IsNotPublicName();
        }
Esempio n. 15
0
        public void WhenAskedForTypeRegistration_ThenReturnsTypeRegistrationConfiguringMockExceptionHandlerWithTheAttributesCollection()
        {
            TypeRegistration typeRegistration = handlerData.GetRegistrations("prefix").First();

            typeRegistration
            .AssertForServiceType(typeof(IExceptionHandler))
            .ForName("prefix.custom")
            .ForImplementationType(typeof(MockExceptionHandler));

            typeRegistration.AssertConstructor()
            .WithValueConstructorParameter(handlerData.Attributes)
            .VerifyConstructorParameters();
        }
        public void WhenGettingRegistrationMessageIsBroughtFromResource()
        {
            IStringResolver resolver;

            typeRegistration
            .AssertForServiceType(typeof(IExceptionHandler))
            .ForName("prefix.wcf")
            .ForImplementationType(typeof(FaultContractExceptionHandler));

            typeRegistration.AssertConstructor()
            .WithValueConstructorParameter(out resolver);

            Assert.AreEqual(Resources.WcfMessageResource, resolver.GetString());
        }
        public void WhenCreatingRegistrations_ThenCreatedTypeRegistrationDescribingTheProvider()
        {
            var typeRegistrations = cryptographySettings.GetRegistrations(null);

            TypeRegistration registration = typeRegistrations.ElementAt(0);

            registration
            .AssertForServiceType(typeof(ISymmetricCryptoProvider))
            .ForName("dpapi")
            .ForImplementationType(typeof(DpapiSymmetricCryptoProvider))
            .IsPublicName();

            registration.AssertConstructor()
            .WithValueConstructorParameter(DataProtectionScope.LocalMachine)
            .VerifyConstructorParameters();
        }
        public void WhenCreatingRegistrations_ThenCreatedTypeRegistrationDescribingTheProvider()
        {
            var typeRegistrations = cryptographySettings.GetRegistrations(null);

            TypeRegistration registration = typeRegistrations.ElementAt(0);

            registration
            .AssertForServiceType(typeof(ISymmetricCryptoProvider))
            .ForName("custom")
            .ForImplementationType(typeof(MockCustomSymmetricProvider))
            .IsPublicName();

            registration.AssertConstructor()
            .WithValueConstructorParameter(customSymmetricCryptoProviderData.Attributes)
            .VerifyConstructorParameters();
        }
Esempio n. 19
0
        public void WhenAskedForTypeRegitration_ThenReturnsTypeRegistrationConfiguringReplaceHandler()
        {
            TypeRegistration typeRegistration = handlerData.GetRegistrations("prefix").First();
            IStringResolver  resolver;

            typeRegistration
            .AssertForServiceType(typeof(IExceptionHandler))
            .ForName("prefix.replace")
            .ForImplementationType(typeof(ReplaceHandler));

            typeRegistration.AssertConstructor()
            .WithValueConstructorParameter(out resolver)
            .WithValueConstructorParameter(typeof(Exception))
            .VerifyConstructorParameters();

            Assert.AreEqual(Resources.ExceptionMessage, resolver.GetString());
        }
        public void WhenCreatingRegistrations_ThenCreatedTypeRegistrationDescribingTheProvider()
        {
            var typeRegistrations = cryptographySettings.GetRegistrations(null);

            TypeRegistration registration = typeRegistrations.Where(x => x.ServiceType == typeof(IHashProvider)).ElementAt(0);

            registration
            .AssertForServiceType(typeof(IHashProvider))
            .ForName("name")
            .ForImplementationType(typeof(HashAlgorithmProvider))
            .IsPublicName();

            registration.AssertConstructor()
            .WithValueConstructorParameter(typeof(RijndaelManaged))
            .WithValueConstructorParameter(true)
            .WithContainerResolvedParameter <IHashAlgorithmInstrumentationProvider>("name")
            .VerifyConstructorParameters();
        }
        public void WhenCreatingRegistrations_ThenCreatedTypeRegistrationDescribingTheProvider()
        {
            var typeRegistrations = settings.GetRegistrations(configurationSource)
                                    .Where(r => r.ServiceType == typeof(Database));

            TypeRegistration registration = typeRegistrations.ElementAt(0);

            registration
            .AssertForServiceType(typeof(Database))
            .ForName("sql connection")
            .ForImplementationType(typeof(SqlDatabase))
            .IsPublicName();

            registration.AssertConstructor()
            .WithValueConstructorParameter("connection string")
            .WithContainerResolvedParameter <IDataInstrumentationProvider>("sql connection")
            .VerifyConstructorParameters();
        }
        public void WhenCreatingRegistrations_ThenCreatedTypeRegistrationDescribingTheProvider()
        {
            var typeRegistrations = cryptographySettings.GetRegistrations(null).Where(x => x.ServiceType == typeof(ISymmetricCryptoProvider));

            TypeRegistration registration = typeRegistrations.ElementAt(0);

            registration
            .AssertForServiceType(typeof(ISymmetricCryptoProvider))
            .ForName("symmetric algorithm")
            .ForImplementationType(typeof(SymmetricAlgorithmProvider))
            .IsPublicName();

            registration.AssertConstructor()
            .WithValueConstructorParameter(typeof(RijndaelManaged))
            .WithValueConstructorParameter("protected key")
            .WithValueConstructorParameter(DataProtectionScope.LocalMachine)
            .WithContainerResolvedParameter <ISymmetricAlgorithmInstrumentationProvider>("symmetric algorithm")
            .VerifyConstructorParameters();
        }
        public void WhenCreatingRegistrations_ThenShouldProvideOdbcRegistration()
        {
            var typeRegistrations = settings.GetRegistrations(configurationSource)
                                    .Where(r => r.ServiceType == typeof(Database));

            TypeRegistration registration = typeRegistrations.ElementAt(0);

            registration
            .AssertForServiceType(typeof(Database))
            .ForName("odbc connection")
            .ForImplementationType(typeof(GenericDatabase))
            .IsPublicName();

            registration.AssertConstructor()
            .WithValueConstructorParameter("connection string")
            .WithValueConstructorParameter <DbProviderFactory>(System.Data.Odbc.OdbcFactory.Instance)
            .WithContainerResolvedParameter <IDataInstrumentationProvider>("odbc connection")
            .VerifyConstructorParameters();
        }
Esempio n. 24
0
 public void ThenRegistryEntryMapsLogFormatterToProvidedTypeByName()
 {
     registration.AssertForServiceType(typeof(ILogFormatter))
     .ForName(formatterData.Name)
     .ForImplementationType(formatterData.Type);
 }
Esempio n. 25
0
 public void ThenShouldProvideProperRegistrationEntry()
 {
     registration.AssertForServiceType(typeof(ILogFormatter))
     .ForName(formatter.Name)
     .ForImplementationType(typeof(TextFormatter));
 }
 public void ThenCryptographyManagerRegistrationIsDefault()
 {
     cryptoManagerRegistration.AssertForServiceType(typeof(CryptographyManager))
     .IsDefault()
     .ForImplementationType(typeof(CryptographyManagerImpl));
 }