Exemplo n.º 1
0
        public void should_use_octopus_environment_provider_when_keys_exist()
        {
            // given
            var config = new JsonConfiguration()
            {
                OctopusConfiguration = new OctopusConfiguration()
                {
                    OctopusApiKey = "I've got the key",
                    OctopusUrl    = "http://localhost"
                }
            };
            var configStoreMock = new ConfigurationStoreMock();

            configStoreMock.Configuration = config;
            IContainer container = GetContainer(configStoreMock);

            // when + then
            AssertDefaultType <IOctopusRepositoryFactory, OctopusRepositoryFactory>(container);

            var octopusRepository = container.GetInstance <IOctopusRepository>() as OctopusRepository;

            Assert.That(octopusRepository, Is.Not.Null);

            AssertDefaultType <IEnvironmentProvider, OctopusEnvironmentProvider>(container);
        }
Exemplo n.º 2
0
        public void should_inject_key_for_encryption()
        {
            // given
            var configuration = new JsonConfiguration()
            {
                EncryptionKey = "my-password"
            };

            var configStore = new ConfigurationStoreMock();

            configStore.Configuration = configuration;
            IContainer container = GetContainer(configStore);

            // when
            var encryptionInstance = container.GetInstance <IEncryption>() as AesEncryption;

            // then
            Assert.That(encryptionInstance, Is.Not.Null);
            Assert.That(encryptionInstance.Password, Is.EqualTo("my-password"));
        }