public void Will_build_local_file_scheme() { var builder = new TestableUrlBuilder(); var context = builder.GetContext(isServerMode: false); var fileUrl = builder.ClassUnderTest.GenerateFileUrl(context, @"c:\some\path.js"); Assert.Equal(@"file:///c:/some/path.js", fileUrl); }
public void Will_build_server_path_for_built_in_dependency() { var builder = new TestableUrlBuilder(); var context = builder.GetContext(isServerMode: true, rootPath: @"c:\root", port: 234, builtInDependencyDirectory: @"c:\chutzpah\testfiles"); var fileUrl = builder.ClassUnderTest.GenerateFileUrl(context, @"c:\chutzpah\testfiles\some\path.js", isBuiltInDependency: true); Assert.Equal(@"http://localhost:234/__chutzpah__/some/path.js", fileUrl); }
public void Will_build_a_server_path_fully_qualified_relative_to_root_path_which_is_not_part_of_path() { var builder = new TestableUrlBuilder(); var context = builder.GetContext(isServerMode: true, rootPath: @"c:\root", port: 234); var fileUrl = builder.ClassUnderTest.GenerateFileUrl(context, @"c:\some\path.js", fullyQualified: true); Assert.Equal(@"http://localhost:234/../some/path.js", fileUrl); }
public void Will_build_a_server_path_relative_to_test_harness_directory() { var builder = new TestableUrlBuilder(); var context = builder.GetContext(isServerMode: true, testHarnessDirectory: @"c:\harness"); var fileUrl = builder.ClassUnderTest.GenerateFileUrl(context, @"c:\some\path.js"); Assert.Equal(@"../some/path.js", fileUrl); }
public void Will_not_prefix_local_path_starting_with_file() { var builder = new TestableUrlBuilder(); var context = builder.GetContext(isServerMode: false); var fileUrl = builder.ClassUnderTest.GenerateFileUrl(context, @"file:///c:/some/path.js"); Assert.Equal(@"file:///c:/some/path.js", fileUrl); }
public void Will_encode_local_path() { var builder = new TestableUrlBuilder(); var context = builder.GetContext(isServerMode: false); var fileUrl = builder.ClassUnderTest.GenerateFileUrl(context, @"c:\c#\path.js"); Assert.Equal(@"file:///c:/c%23/path.js", fileUrl); }