code/Kingdom.OrTools.Sat.CodeGeneration.Tests/PathTests.cs
/// <summary>
/// Verifies a couple of academic and even interesting test cases.
/// Then we verify the truly interesting test case for what we aim to accomplish.
/// </summary>
/// <param name="basePath"></param>
/// <param name="otherPath"></param>
/// <param name="expectedRelativePath"></param>
Verifies a couple of academic and even interesting test cases.
Then we verify the truly interesting test case for what we aim to accomplish.
Verifies a couple of academic and even interesting test cases . Then we verify the truly interesting test case for what we aim to accomplish .
[Theory
         , InlineData(@"D:\This\Is\A\Test", @"D:\This\Is", @"..\..\..\Is")
         , InlineData(@"D:\This\Is", @"D:\This\Is\A\Test", @"A\Test")
         , InlineData(@"D:\Source\My.Project\bin\Debug\netstandard2.0"
             , @"D:\Source\packages\Google.OrTools\1.2.3456\content\sat\sat_parameters.proto"
             , @"..\..\..\..\packages\Google.OrTools\1.2.3456\content\sat\sat_parameters.proto")
        ]
        public void Verify_Relative_Path(string basePath, string otherPath, string expectedRelativePath)
        {
            OutputHelper.WriteLine($"`{nameof(basePath)}´ = `{basePath}´");
            OutputHelper.WriteLine($"`{nameof(otherPath)}´ = `{otherPath}´");
            OutputHelper.WriteLine($"`{nameof(expectedRelativePath)}´ = `{expectedRelativePath}´");
            var actualRelativePath = basePath.GetRelativePath(otherPath);
            OutputHelper.WriteLine($"`{nameof(actualRelativePath)}´ = `{actualRelativePath}´");
            actualRelativePath.AssertEqual(expectedRelativePath);
        }
[ Theory , InlineData ( @"D:\This\Is\A\Test" , @"D:\This\Is" , @"..\..\..\Is" ) , InlineData ( @"D:\This\Is" , @"D:\This\Is\A\Test" , @"A\Test" ) , InlineData ( @"D:\Source\My.Project\bin\Debug\netstandard2.0" , @"D:\Source\packages\Google.OrTools\1.2.3456\content\sat\sat_parameters.proto" , @"..\..\..\..\packages\Google.OrTools\1.2.3456\content\sat\sat_parameters.proto" ) ] public void Verify_Relative_Path ( string basePath , string otherPath , string expectedRelativePath ) { OutputHelper . WriteLine ( $" ` { nameof ( basePath ) } ´ = `{ b asePath} ´ ") ; OutputHelper . WriteLine ( $" ` { nameof ( otherPath ) } ´ = `{ o therPath} ´ ") ; OutputHelper . WriteLine ( $" ` { nameof ( expectedRelativePath ) } ´ = `{ e xpectedRelativePath} ´ ") ; var actualRelativePath = basePath . GetRelativePath ( otherPath ) ; OutputHelper . WriteLine ( $" ` { nameof ( actualRelativePath ) } ´ = `{ a ctualRelativePath} ´ ") ; actualRelativePath . AssertEqual ( expectedRelativePath ) ; }
Verifies a couple of academic and even interesting test cases.
Verifies a couple of academic and even interesting test cases .
// ReSharper disable once StringLiteralTypo
basePath
string
None
otherPath
string
None
expectedRelativePath
string
None