예제 #1
0
        public void ShouldLoadPropertiesFromEnvironmentsFile()
        {
            var stubFileSystem = new Mock<FileSystem>();
            stubFileSystem.Setup(fs => fs.ListAllFilesIn("Environments", "*.properties")).Returns(new[] { "prod.properties" });
            stubFileSystem.Setup(fs => fs.ReadAllText(@"Environments\prod.properties"))
                .Returns(@"<?xml version='1.0' encoding='utf-8'?>
                    <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                        <PropertyGroup>
                            <key1>value1</key1>
                            <key2>value2</key2>
                        </PropertyGroup>
                    </Project>");
            var loader = new EnvironmentFilesLoader(stubFileSystem.Object, "Environments", "properties");

            Assert.That(loader.GetProperties("prod"), Is.EqualTo(new PropertyList().Add("key1", "value1").Add("key2", "value2")));
        }
예제 #2
0
 public void ShouldReturnEmptyPropertyListForEmptyEnvironment()
 {
     var loader = new EnvironmentFilesLoader(null, "Environments", "properties");
     Assert.That(loader.GetProperties(""), Is.EqualTo(new PropertyList()));
     Assert.That(loader.GetProperties(null), Is.EqualTo(new PropertyList()));
 }