Ejemplo n.º 1
0
        public void Test_GetRedirectPath_Setup()
        {
            Uri url = new Uri("http://localhost/Test/Default.aspx");

            string applicationName = "TestApplication";

            string pathVariation = "testing";

            string appConfigPath = TestUtilities.GetTestDataPath(this, applicationName) + Path.DirectorySeparatorChar + "Application." + pathVariation + ".config";

            IFileMapper fileMapper = new MockFileMapper(this,TestUtilities.GetTestingPath(this), applicationName);

            SetupChecker checker = new SetupChecker(url, applicationName, fileMapper);
            checker.Installer = new ApplicationInstaller(applicationName, pathVariation, fileMapper);
            //checker.Installer = new ApplicationInstaller(applicationName, pathVariation);
            //checker.Installer.FileMapper = new MockFileMapper(this,TestUtilities.GetTestingPath(this), applicationName);

            //checker.Restorer = new ApplicationRestorer();

            string redirectPath = checker.GetRedirectPath();

            string expected = applicationName + "/Admin/Setup.aspx";

            Assert.AreEqual(expected.ToLower(), redirectPath.ToLower(), "The redirect path didn't return the expected value.");
        }
 public MockFileExistenceChecker(BaseTestFixture fixture, bool doesExist)
 {
     DoesExist = doesExist;
     FileMapper = new MockFileMapper(fixture);
 }
        public void Test_GetInternalPath_Action_Type_ID_IgnoreText()
        {
            string entityName = "TestUsername";
            string entityID = "A1FC7BA3-3832-467f-8989-058BF420D1D9";

            string fullApplicationUrl = "http://localhost/MockApplication";
            string applicationPath = "/MockApplication";

            string action = "Edit";
            string typeName = "TestUser";

            string original = fullApplicationUrl + "/" + action + "-" + typeName + "/" + entityID + "/I--" + entityName + ".aspx";

            string expected = applicationPath + "/Projector.aspx?a=" + action + "&t=" + typeName + "&f=Html&" + typeName + "-ID=" + entityID;

            IFileMapper fileMapper = new MockFileMapper(this, TestUtilities.GetTestingPath(this));

            ProjectionMapper mapper = new ProjectionMapper();
            mapper.Converter = new MockUrlConverter();
            mapper.FileMapper = new MockFileMapper(this);
            mapper.FileExistenceChecker = new MockFileExistenceChecker(this, false);

            string generated = mapper.GetInternalPath(original);

            Assert.AreEqual(expected.ToLower(), generated.ToLower(), "Result doesn't match expected.");
        }