public void GetRootedPath_WithRootedRelativePath_ReturnsFullPath()
        {
            string path     = @"\foo\bar.txt";
            string fullPath = Path.GetFullPath(path);

            Assert.That(QueryFileElement.GetRootedPath(path), Is.EqualTo(fullPath));
        }
        public void GetRootedPath_WithUnrootedPath_ReturnsPathRelativeToAppBase()
        {
            string path     = @"foo\bar.txt";
            string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"foo\bar.txt");

            Assert.That(QueryFileElement.GetRootedPath(path), Is.EqualTo(fullPath));
        }
        public void GetRootedPath_WithUnrootedPath_ReturnsPathRelativeToAppBase_InSeparateAddDomain()
        {
            AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;

            setup.ApplicationBase = @"c:\";
            setup.DynamicBase     = Path.GetTempPath();
            new AppDomainRunner(setup, delegate
            {
                string path     = @"foo\bar.txt";
                string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"foo\bar.txt");
                Assert.That(QueryFileElement.GetRootedPath(path), Is.EqualTo(fullPath));
            }).Run();
        }
        public void GetRootedPath_WithFullPath_ReturnsFullPath()
        {
            string path = @"c:\foo\bar.txt";

            Assert.That(QueryFileElement.GetRootedPath(path), Is.EqualTo(path));
        }