| | 1 | | using System; |
| | 2 | | using System.Diagnostics.CodeAnalysis; |
| | 3 | | using System.Text; |
| | 4 | | using Amusoft.DotnetNew.Tests.Interfaces; |
| | 5 | | using Amusoft.DotnetNew.Tests.Utility; |
| | 6 | |
|
| | 7 | | namespace Amusoft.DotnetNew.Tests.Rewriters; |
| | 8 | |
|
| | 9 | | internal class FolderNameAliasRewriter : ICommandRewriter, IEquatable<FolderNameAliasRewriter> |
| | 10 | | { |
| 14 | 11 | | public CrossPlatformPath Folder { get; } |
| 14 | 12 | | public string Alias { get; } |
| | 13 | |
|
| 7 | 14 | | public FolderNameAliasRewriter(CrossPlatformPath folder, string alias) |
| | 15 | | { |
| 7 | 16 | | Folder = folder; |
| 7 | 17 | | Alias = alias; |
| 7 | 18 | | } |
| | 19 | |
|
| 14 | 20 | | public int ExecutionOrder { get; } = 3; |
| | 21 | |
|
| | 22 | | public void Rewrite(StringBuilder stringBuilder) |
| | 23 | | { |
| 7 | 24 | | stringBuilder.Replace(Folder.VirtualPath, $"{{{Alias}}}"); |
| 7 | 25 | | stringBuilder.Replace(Folder.OriginalPath, $"{{{Alias}}}"); |
| 7 | 26 | | } |
| | 27 | |
|
| | 28 | | [ExcludeFromCodeCoverage] |
| | 29 | | public bool Equals(FolderNameAliasRewriter? other) |
| | 30 | | { |
| | 31 | | if (other is null) |
| | 32 | | return false; |
| | 33 | |
|
| | 34 | | return Folder.Equals(other.Folder) && Alias.Equals(other.Alias); |
| | 35 | | } |
| | 36 | | } |