Example #1
0
        protected override void beforeEach()
        {
            theBaseFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "folder1");
            theBinFolder  = Path.Combine(theBaseFolder, "bin");

            theManifest = new PackageManifest
            {
                ContentFileSet   = new FileSet(),
                Assemblies       = new[] { "A", "B", "C" },
                NativeAssemblies = new[] { "D", "E" }
            };

            theInput = new CreateBottleInput {
                PackageFolder = theBaseFolder
            };

            theAssemblyFiles = new AssemblyFiles
            {
                Files             = new[] { "a.dll", "b.dll", "d.dll" },
                MissingAssemblies = new[] { "c", "e" },
                PdbFiles          = new[] { "a.pdb", "b.pdb", "c.pdb" }
            };

            MockFor <IAssemblyFileFinder>()
            .Stub(x => x.FindAssemblies(theBinFolder, theManifest.AllAssemblies))
            .Return(theAssemblyFiles);

            ClassUnderTest.CreatePackage(theInput, theManifest);
        }
        protected override void beforeEach()
        {
            var root = Path.GetPathRoot(AppDomain.CurrentDomain.BaseDirectory);

            theInput = new CreateBottleInput()
            {
                PackageFolder = "some folder",
                ZipFileFlag   = root.AppendPath("package1.zip")
            };

            theManifest = new PackageManifest();
            Services.PartialMockTheClassUnderTest();
        }
Example #3
0
        protected override void beforeEach()
        {
            theBaseFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "folder1");
            theBinFolder  = Path.Combine(theBaseFolder, "bin");

            theManifest = new PackageManifest
            {
                ContentFileSet = new FileSet()
            };

            theManifest.AddAssembly("A");
            theManifest.AddAssembly("B");
            theManifest.AddAssembly("C");

            theInput = new CreateBottleInput()
            {
                PackageFolder = theBaseFolder,
                ZipFileFlag   = Path.Combine(theBaseFolder, "package1.zip"),
                PdbFlag       = true
            };

            theAssemblyFiles = new AssemblyFiles()
            {
                Files = new string[] {
                    FileSystem.Combine(theBinFolder, "a.dll"),
                    FileSystem.Combine(theBinFolder, "b.dll"),
                    FileSystem.Combine(theBinFolder, "c.dll")
                },
                MissingAssemblies = new string[0],
                PdbFiles          = new string[] {
                    FileSystem.Combine(theBinFolder, "a.pdb"),
                    FileSystem.Combine(theBinFolder, "b.pdb"),
                    FileSystem.Combine(theBinFolder, "c.pdb")
                },
            };

            MockFor <IAssemblyFileFinder>()
            .Stub(x => x.FindAssemblies(theBinFolder, theManifest.AllAssemblies))
            .Return(theAssemblyFiles);

            _theZipFileService = new StubZipFileService();
            Services.Inject <IZipFileService>(_theZipFileService);

            thePackageManifestFileName = FileSystem.Combine(theBaseFolder, PackageManifest.FILE);

            ClassUnderTest.CreatePackage(theInput, theManifest);
        }
Example #4
0
        protected override void beforeEach()
        {
            theBaseFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "folder1");

            theManifest = new PackageManifest();
            theManifest.SetRole(BottleRoles.Data);

            theInput = new CreateBottleInput {
                PackageFolder = theBaseFolder
            };

            theZipFile = new StubZipFile();

            ClassUnderTest.AddDataFiles(theInput, theZipFile, theManifest);

            theRequest = theZipFile.ZipRequests.Single();
        }
Example #5
0
        public void WriteAssembliesNotFound(AssemblyFiles theAssemblyFiles, PackageManifest manifest, CreateBottleInput input, string binFolder)
        {
            ConsoleWriter.Write("Did not locate all designated assemblies at '{0}'", binFolder);
            ConsoleWriter.Write("Looking for these assemblies in the package manifest file:");
            manifest.Assemblies.Each(name => ConsoleWriter.Write("  " + name));
            ConsoleWriter.Write("But only found:");
            if (!theAssemblyFiles.Files.Any())
            {
                ConsoleWriter.Write("  Found no files");
            }
            theAssemblyFiles.Files.Each(file => ConsoleWriter.Write("  " + file));

            ConsoleWriter.Write("Missing");
            theAssemblyFiles.MissingAssemblies.Each(file => ConsoleWriter.Write("  " + file));

            throw new ApplicationException("Invalid package manifest or missing files");
        }
Example #6
0
        public void WriteAssembliesNotFound(AssemblyFiles theAssemblyFiles, PackageManifest manifest, CreateBottleInput input, string binFolder)
        {
            var log = _log.LogFor(manifest);

            var sb = new StringBuilder();

            sb.AppendFormat("Did not locate all designated assemblies at '{0}'", binFolder.ToFullPath());
            sb.AppendLine();


            sb.AppendLine("Looking for these assemblies in the package manifest file:");
            manifest.Assemblies.Each(name => sb.AppendLine("  " + name));


            sb.AppendLine("But only found:");
            if (!theAssemblyFiles.Files.Any())
            {
                sb.AppendLine("  Found no files");
            }
            theAssemblyFiles.Files.Each(file => sb.AppendLine("  " + file));

            sb.AppendLine("Missing");
            theAssemblyFiles.MissingAssemblies.Each(file => sb.AppendLine("  " + file));

            log.MarkFailure(sb.ToString());
        }