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."); }
public void TestGetAbsolutePathException() { Assert.Throws <UriFormatException>(() => ModelUtils.GetAbsolutePath("subdir/file")); Assert.Throws <UriFormatException>(() => ModelUtils.GetAbsolutePath("subdir/file", new FeedUri("http://remote/"))); }