Exemplo n.º 1
0
        private async Task ProjectRenamedOnWriter(object sender, ProjectRenamedEventArgs args)
        {
            var oldImportName = FileSystemMirroringProjectUtilities.GetInMemoryTargetsFileName(args.OldFullPath);
            var newImportName = FileSystemMirroringProjectUtilities.GetInMemoryTargetsFileName(args.NewFullPath);

            using (var access = await _projectLockService.WriteLockAsync()) {
                await access.CheckoutAsync(_unconfiguredProject.FullPath);

                var xml = await access.GetProjectXmlAsync(_unconfiguredProject.FullPath);

                var import = xml.Imports.FirstOrDefault(i => i.Project.EqualsIgnoreCase(oldImportName));
                if (import != null)
                {
                    import.Project   = newImportName;
                    import.Condition = $"Exists('{newImportName}')";
                    await Project.UpdateFullPathAsync(access);
                }
            }
        }
        public void GetInMemoryTargetsFileName(string filename, string expected)
        {
            var actual = FileSystemMirroringProjectUtilities.GetInMemoryTargetsFileName(filename);

            actual.Should().BeEquivalentTo(expected);
        }