Exemplo n.º 1
0
        public static void ScaffoldingExists(string destinationDirectory, string scaffoldFilePath, string roleName = "WebRole")
        {
            Scaffold scaffold = Scaffold.Parse(Path.Combine(Data.TestResultDirectory, scaffoldFilePath, Resources.ScaffoldXml));

            foreach (ScaffoldFile file in scaffold.Files)
            {
                if (file.Copy)
                {
                    string elementPath;
                    if (string.IsNullOrEmpty(file.PathExpression))
                    {
                        elementPath = string.IsNullOrEmpty(file.TargetPath) ? Path.Combine(destinationDirectory, file.Path) : Path.Combine(destinationDirectory, file.TargetPath);
                        elementPath = elementPath.Replace("$RoleName$", roleName);
                        Assert.IsTrue(File.Exists(elementPath));
                    }
                    else
                    {
                        string substring = file.PathExpression.Substring(0, file.PathExpression.LastIndexOf('\\'));
                        elementPath = string.IsNullOrEmpty(file.TargetPath) ? Path.Combine(destinationDirectory, substring) : Path.Combine(destinationDirectory, file.TargetPath);
                        elementPath = elementPath.Replace("$RoleName$", roleName);
                        Assert.IsTrue(Directory.Exists(elementPath));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void ParseTests()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string path = files.CreateEmptyFile("Scaffold.xml");
                FileUtilities.DataStore.WriteFile(path, Resources.ValidScaffoldXml);

                Scaffold scaffold = Scaffold.Parse(path);

                Assert.Equal(scaffold.Files.Count, 6);
                Assert.Equal(scaffold.Files[0].PathExpression, "modules\\.*");
                Assert.Equal(scaffold.Files[1].Path, @"bin/node123dfx65.exe");
                Assert.Equal(scaffold.Files[1].TargetPath, @"/bin/node.exe");
                Assert.Equal(scaffold.Files[2].Path, @"bin/iisnode.dll");
                Assert.Equal(scaffold.Files[3].Path, @"bin/setup.cmd");
                Assert.Equal(scaffold.Files[4].Path, "Web.config");
                Assert.Equal(scaffold.Files[4].Rules.Count, 1);
                Assert.Equal(scaffold.Files[5].Path, "WebRole.xml");
                Assert.Equal(scaffold.Files[5].Copy, false);
                Assert.Equal(scaffold.Files[5].Rules.Count, 1);
            }
        }