public void FileExists_PhysicalFileDoesNotExist() { var provider = new TestableResourceVirtualPathProvider(new[] { new ResourcePathMapping("test", "testResourceFolder") }, _testDirectory); provider.SetMakeRelativeVirtualPathOverride((a, b) => "testfile.txt"); provider.SetCombineVirtualPathOverride((a, b) => "~/res/test/"); Directory.CreateDirectory(Path.Combine(_testDirectory, "testResourceFolder")); Assert.That(provider.FileExists("~/res/test/testfile.txt"), Is.False); }
public void FileExists_NotMappedDirectory_FallsBackToPreviousProvider() { var previousProviderStub = MockRepository.GenerateStub <VirtualPathProvider>(); var provider = new TestableResourceVirtualPathProvider(new[] { new ResourcePathMapping("test", "testResourceFolder") }, _testDirectory); provider.SetPrevious(previousProviderStub); previousProviderStub.Stub(_ => _.FileExists("~/res/UnknownDirectory/testfile.txt")).Return(true); Assert.That(provider.FileExists("~/res/UnknownDirectory/testfile.txt"), Is.True); }
public void FileExists() { var provider = new TestableResourceVirtualPathProvider(new[] { new ResourcePathMapping("test", "testResourceFolder") }, _testDirectory); provider.SetMakeRelativeVirtualPathOverride((a, b) => "testfile.txt"); provider.SetCombineVirtualPathOverride((a, b) => "~/res/test/"); Directory.CreateDirectory(Path.Combine(_testDirectory, "testResourceFolder")); File.WriteAllText(Path.Combine(_testDirectory, "testResourceFolder\\testfile.txt"), "hello"); Assert.That(provider.FileExists("~/res/test/testfile.txt")); }