Example #1
0
        public void RebaseUriVisitor_VisitFileData_DoesNotPatchUriAndParentWhenNotAppropriate()
        {
            Uri      fileUri   = new Uri(@"file://*****:*****@"C:\src\root\blah.zip";
            FileData fileData  = new FileData()
            {
                Uri = fileUri, ParentKey = parentKey
            };
            Run run = new Run()
            {
                Files = new Dictionary <string, FileData>()
                {
                    { fileUri.ToString(), fileData }
                }
            };

            string           bldroot          = "BLDROOT";
            RebaseUriVisitor rebaseUriVisitor = new RebaseUriVisitor(bldroot, new Uri(@"C:\bld\"));

            rebaseUriVisitor.FixFiles(run);

            run.Files.Should().ContainKey(fileUri.ToString());
            var newFileData = run.Files[fileUri.ToString()];

            newFileData.Uri.Should().BeSameAs(fileUri);
            newFileData.UriBaseId.Should().BeNullOrEmpty();
            newFileData.ParentKey.Should().BeSameAs(parentKey);
        }
Example #2
0
        public void RebaseUriVisitor_VisitFileData_PatchesUriAndParentUri()
        {
            Uri      fileUri   = new Uri(@"file://*****:*****@"C:\src\root\blah.zip";
            FileData fileData  = new FileData()
            {
                Uri = fileUri, ParentKey = parentKey
            };
            Run run = new Run()
            {
                Files = new Dictionary <string, FileData>()
                {
                    { fileUri.ToString(), fileData }
                }
            };

            string           srcroot          = "SRCROOT";
            RebaseUriVisitor rebaseUriVisitor = new RebaseUriVisitor(srcroot, new Uri(@"C:\src\root\"));

            rebaseUriVisitor.FixFiles(run);

            run.Files.Should().ContainKey("blah.zip#/stuff.doc");
            var newFileData = run.Files["blah.zip#/stuff.doc"];

            newFileData.Uri.IsAbsoluteUri.Should().BeFalse();
            newFileData.Uri.Should().NotBeSameAs(fileUri);
            newFileData.UriBaseId.Should().Be(srcroot);
            newFileData.ParentKey.Should().NotBeSameAs(parentKey);
        }