Example #1
0
        //[TestMethod]
        public void NodeModuleGenerator_should_create_a_publishable_powershell_module()
        {
            IShellWrapper sut = null;

            RunPackageTest(sut, filesToExamine: () => (from f in Directory.EnumerateFiles(sut.PackageDirectory, "*", SearchOption.AllDirectories)
                                                       where Path.GetExtension(f) == ".js"
                                                       select f));
        }
Example #2
0
        private static void RunPackageTest(IShellWrapper sut, Func <IEnumerable <string> > filesToExamine)
        {
            //  Act
            sut.GeneratePackage(GetCommandList(), typeof(PackageGeneratorTest).Assembly.Location);
            var package  = new DirectoryInfo(sut.PackageDirectory);
            var fileList = (from f in package.GetFiles("*", SearchOption.AllDirectories)
                            select f.FullName.Replace(package.FullName, string.Empty));

            // Assert
            package.Exists.ShouldBeTrue();

            using (ApprovalResults.ForScenario("fileList"))
            {
                Approvals.VerifyAll(fileList, "PS");
            }

            foreach (string file in filesToExamine())
            {
                using (ApprovalResults.ForScenario(Path.GetFileNameWithoutExtension(file)))
                {
                    Approvals.Verify(File.ReadAllText(file));
                }
            }
        }