Ejemplo n.º 1
0
        public void An_embedded_configuration_file_can_replace_the_current_configuration()
        {
            TestFile.FromCurrentConfigurationFile().InvokeAndPreserve(currentConfigurationFile =>
            {
                var embeddedFile = TestFile.FromEmbeddedResource(typeof(TestFileTests).Assembly, EmbeddedConfigurationResourceName, EmbeddedConfigurationFileName);
                currentConfigurationFile.ReplaceWith(embeddedFile);

                Assert.That(ConfigurationManager.AppSettings["EmbeddedConfiguration"], Is.EqualTo("This is an embedded configuration"));
            });
        }
Ejemplo n.º 2
0
 public void Trying_to_use_a_resource_that_does_not_exists_is_not_ok()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           TestFile.FromEmbeddedResource(typeof(TestFileTests).Assembly, "UnknownResource", "UnknownResource"));
 }
Ejemplo n.º 3
0
        public void An_embedded_configuration_file_can_be_saved_to_disk()
        {
            var embeddedConfigurationFile = TestFile.FromEmbeddedResource(typeof(TestFileTests).Assembly, EmbeddedConfigurationResourceName, EmbeddedConfigurationFileName);

            Assert.That(File.Exists(embeddedConfigurationFile.FullName));
        }