public void Test_GetInternalPath_Skip()
        {
            string fullApplicationUrl = "http://localhost/MockApplication";
            string applicationPath = "/MockApplication";

            string original = fullApplicationUrl + "/Admin/Setup.aspx";

            string expected = "";

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

            string generated = mapper.GetInternalPath(original);

            Assert.AreEqual(expected.ToLower(), generated.ToLower(), "Result doesn't match expected.");
        }
        public void Test_GetInternalPath_Action_Type_KeepOriginalQueryStrings()
        {
            string fullApplicationUrl = "http://localhost/MockApplication";
            string applicationPath = "/MockApplication";

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

            string original = fullApplicationUrl + "/" + action + "-" + typeName + ".aspx?TestKey=TestValue";

            string expected = applicationPath + "/Projector.aspx?a=" + action + "&t=" + typeName + "&f=Html&TestKey=TestValue";

            ProjectionMapper mapper = new ProjectionMapper();
            mapper.ApplicationPath = applicationPath;
            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.");
        }
        public void Test_GetInternalPath_ProjectionName_KeepExistingQueryStrings()
        {
            string fullApplicationUrl = "http://localhost/MockApplication";
            string applicationPath = "/MockApplication";

            string original = fullApplicationUrl + "/Settings.aspx?TestKey=TestValue";

            string expected = applicationPath + "/Projector.aspx?n=Settings&f=Html&TestKey=TestValue";

            // Create the mock settings projection
            ProjectionInfo info = new ProjectionInfo();
            info.Name = "Settings";
            ProjectionState.Projections.Add(info);

            ProjectionMapper mapper = new ProjectionMapper();
            mapper.ApplicationPath = applicationPath;
            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.");
        }
        public void Test_GetInternalPath_Action_Type_ID_Key()
        {
            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 + "/K--" + entityName + ".aspx";

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

            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.");
        }