Ejemplo n.º 1
0
        public void RuntimeBreadcrumbIsCreated()
        {
            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);
            breadcrumbs.CreateRuntimeBreadcrumb();

            var runtimeBreadcrumbFile = typeof(Servicing.Breadcrumbs).Assembly.GetName().Name;
            Assert.True(File.Exists(Path.Combine(TempFolderPath, runtimeBreadcrumbFile)));
        }
Ejemplo n.º 2
0
        public void EnqueueDoesNotWriteToDisk()
        {
            Assert.Empty(Directory.GetFiles(TempFolderPath));

            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);
            breadcrumbs.AddBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));

            Assert.False(File.Exists(Path.Combine(TempFolderPath, "Test.1.0.0")));
        }
Ejemplo n.º 3
0
        public void EnqueueDoesNotWriteToDisk()
        {
            Assert.Empty(Directory.GetFiles(TempFolderPath));

            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);

            breadcrumbs.AddBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));

            Assert.False(File.Exists(Path.Combine(TempFolderPath, "Test.1.0.0")));
        }
Ejemplo n.º 4
0
        public void BreadcrumbsAreCreatedSuccessfully()
        {
            Assert.Empty(Directory.GetFiles(TempFolderPath));

            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);
            breadcrumbs.AddBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));
            breadcrumbs.WriteAllBreadcrumbs();

            Assert.True(File.Exists(Path.Combine(TempFolderPath, "Test.1.0.0")));
        }
Ejemplo n.º 5
0
        public void RuntimeBreadcrumbIsCreated()
        {
            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);

            breadcrumbs.CreateRuntimeBreadcrumb();

            var runtimeBreadcrumbFile = typeof(Servicing.Breadcrumbs).Assembly.GetName().Name;

            Assert.True(File.Exists(Path.Combine(TempFolderPath, runtimeBreadcrumbFile)));
        }
Ejemplo n.º 6
0
        public void BreadcrumbsAreCreatedSuccessfully()
        {
            Assert.Empty(Directory.GetFiles(TempFolderPath));

            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);

            breadcrumbs.AddBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));
            breadcrumbs.WriteAllBreadcrumbs();

            Assert.True(File.Exists(Path.Combine(TempFolderPath, "Test.1.0.0")));
        }
Ejemplo n.º 7
0
        public void BreadcrumbsFolderNotCreatedIfDoesntExist()
        {
            var nonExistingBreadcrumbsFolder = Path.Combine(Path.GetTempPath(), "fake_breadcrumbs");
            if (Directory.Exists(nonExistingBreadcrumbsFolder))
            {
                Directory.Delete(nonExistingBreadcrumbsFolder);
            }

            var breadcrumbs = new Servicing.Breadcrumbs(nonExistingBreadcrumbsFolder);
            breadcrumbs.CreateBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));

            Assert.False(Directory.Exists(nonExistingBreadcrumbsFolder));
        }
Ejemplo n.º 8
0
        public void BreadcrumbsCreationDoesNotFailWhenAccessDenied()
        {
            var userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

            var directory = new DirectoryInfo(TempFolderPath);
            var security = new DirectorySecurity();
            security.AddAccessRule(new FileSystemAccessRule(userName, FileSystemRights.Write, AccessControlType.Deny));
            directory.SetAccessControl(security);

            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);
            breadcrumbs.CreateBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));

            Assert.Empty(Directory.GetFiles(TempFolderPath));
        }
Ejemplo n.º 9
0
        public void BreadcrumbsFolderNotCreatedIfDoesntExist()
        {
            var nonExistingBreadcrumbsFolder = Path.Combine(Path.GetTempPath(), "fake_breadcrumbs");

            if (Directory.Exists(nonExistingBreadcrumbsFolder))
            {
                Directory.Delete(nonExistingBreadcrumbsFolder);
            }

            var breadcrumbs = new Servicing.Breadcrumbs(nonExistingBreadcrumbsFolder);

            breadcrumbs.CreateBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));

            Assert.False(Directory.Exists(nonExistingBreadcrumbsFolder));
        }
Ejemplo n.º 10
0
        public void BreadcrumbsCreationDoesNotFailWhenAccessDenied()
        {
            var userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

            var directory = new DirectoryInfo(TempFolderPath);
            var security  = new DirectorySecurity();

            security.AddAccessRule(new FileSystemAccessRule(userName, FileSystemRights.Write, AccessControlType.Deny));
            directory.SetAccessControl(security);

            var breadcrumbs = new Servicing.Breadcrumbs(TempFolderPath);

            breadcrumbs.CreateBreadcrumb("Test", new NuGet.SemanticVersion("1.0.0"));

            Assert.Empty(Directory.GetFiles(TempFolderPath));
        }