Exemplo n.º 1
0
            public void ThrowsWhenNoConfigurationAvailable()
            {
                var exception = Assert.Throws <InvalidOperationException>(
                    () => TransactClient.CreateUsingConfiguration(_configProvider));

                Assert.Equal(
                    "Unable to create TransactClient using configuration. " +
                    "No configuration was provided.",
                    exception.Message);
            }
Exemplo n.º 2
0
        protected override void ConfigureApplicationContainer(ILifetimeScope existingContainer)
        {
            var builder = new ContainerBuilder();

            builder
            .Register <TransactClient>(x => TransactClient.CreateUsingConfiguration())
            .SingleInstance();

            builder.Update(existingContainer.ComponentRegistry);

            base.ConfigureApplicationContainer(existingContainer);
        }
Exemplo n.º 3
0
            public void UsesConfigSection()
            {
                Mock.Get(_configProvider)
                .Setup(x => x.GetFromConfigurationSection())
                .Returns(new TransactClientConfiguration
                {
                    Username = "******"
                });

                var client = TransactClient.CreateUsingConfiguration(_configProvider);

                Assert.Equal("username-from-config-section", client.Configuration.Username);
            }