Example #1
0
        public void TestGetAbsolutePath()
        {
            string absolutePath = WindowsUtils.IsWindows ? @"C:\local\subdir\file" : "/local/subdir/file";

            string result = ModelUtils.GetAbsolutePath("subdir/file", new FeedUri(WindowsUtils.IsWindows ? @"C:\local\" : "/local/"));

            Path.IsPathRooted(result).Should().BeTrue();
            result.Should().Be(absolutePath);

            ModelUtils.GetAbsolutePath(absolutePath)
            .Should().Be(absolutePath, because: "Should ignore source if path is already absolute.");
        }
Example #2
0
 public void TestGetAbsolutePathException()
 {
     Assert.Throws <UriFormatException>(() => ModelUtils.GetAbsolutePath("subdir/file"));
     Assert.Throws <UriFormatException>(() => ModelUtils.GetAbsolutePath("subdir/file", new FeedUri("http://remote/")));
 }