public void WhenIHaveAKnownDoubleConfigurationValueAndITryToRetrieveIt_ThenTheValueIsAsExpected()
        {
            var configuration = new ConfigurationBuilder().WithName("MyTestDouble").WithApplication(_application).WithValue("3.142").Build();
            new CreateConfigurationFake().Execute(configuration);

            var value = Config.Settings<double>("MyTestDouble");
            Assert.That(value, Is.EqualTo(3.142));
        }
        public void WhenIHaveAKnownBooleanConfigurationValueAndITryToRetrieveIt_ThenTheValueIsAsExpected()
        {
            var configuration = new ConfigurationBuilder().WithName("MyTestBoolean").WithApplication(_application).WithValue("true").Build();
            new CreateConfigurationFake().Execute(configuration);

            var value = Config.Settings<bool>("MyTestBoolean");
            Assert.That(value, Is.True);
        }
        public void WhenIHaveAKnownDateTimeConfigurationValueAndITryToRetrieveIt_ThenTheValueIsAsExpected()
        {
            var dateTime = DateTime.Now;
            var configuration = new ConfigurationBuilder().WithName("MyTestDateTime").WithApplication(_application).WithValue(dateTime.ToString()).Build();
            new CreateConfigurationFake().Execute(configuration);

            var value = Config.Settings<DateTime>("MyTestDateTime");
            Assert.That(value, Is.EqualTo(DateTime.Parse(dateTime.ToString())));
        }
        public void WhenITryToSaveADuplicateConfiguration_ThenSaveConfigurationExceptionIsThrown()
        {
            var saveConfiguration = new CreateConfigurationFake();
            var saveApplication = new CreateApplicationFake();
            var getApplicationByName = new GetApplicationByName();

            var application = new ApplicationBuilder()
                .WithName("Test12345")
                .Build();

            saveApplication.Execute(application);
            application = getApplicationByName.Execute(application.Name);

            var configuration = new ConfigurationBuilder()
                .WithName("MyTestFeature")
                .WithValue("Hello World")
                .WithApplication(application).Build();

            saveConfiguration.Execute(configuration);

            Assert.Throws<CreateConfigurationException>(() => saveConfiguration.Execute(configuration));
        }
        public void WhenIHaveAKnownUriConfigurationValueAndITryToRetrieveIt_ThenTheValueIsAsExpected()
        {
            const string uri = "http://localhost:51346/";
            var configuration = new ConfigurationBuilder().WithName("MyTestUri").WithApplication(_application).WithValue(uri).Build();
            new CreateConfigurationFake().Execute(configuration);

            var value = Config.Settings<Uri>("MyTestUri");
            Assert.That(value.AbsoluteUri, Is.EqualTo(uri));
        }
        public void WhenIHaveAKnownStringConfigurationValueAndITryToRetrieveIt_ThenTheValueIsAsExpected()
        {
            var configuration = new ConfigurationBuilder().WithName("MyTestString").WithApplication(_application).WithValue("Hello World").Build();
            new CreateConfigurationFake().Execute(configuration);

            var value = Config.Settings<string>("MyTestString");
            Assert.That(value, Is.EqualTo("Hello World"));
        }