コード例 #1
0
        public void Navigation_Building_ValidUrl()
        {
            var url = new NavigationUrl("/Main/Detail");

            url.AddArg("a1", "E R");
            url.AddArg("a2", 5);
            url.AddArg("a3", true);
            const string expected = "/Main/Detail?a1=E%20R&a2=5&a3=True";

            Assert.AreEqual(expected, url.ToString());
        }
コード例 #2
0
        public void Navigation_Parsing_ValidUrl()
        {
            var url = new NavigationUrl("/Main/Detail?a1=ER&d2=3&d3=true");

            Assert.AreEqual(2, url.Segments.Length);
            Assert.AreEqual("Main", url.Segments[0].Value);
            Assert.AreEqual("Detail", url.Segments[1].Value);
            Assert.AreEqual("ER", url.Segments[1].Query.Get <string>("a1"));
            Assert.AreEqual(3, url.Segments[1].Query.Get <int>("d2"));
            Assert.AreEqual(true, url.Segments[1].Query.Get <bool>("d3"));
        }
コード例 #3
0
        public void NavigationQueryUrlParser_Parsing_Guid()
        {
            string part1 = "part1", part2 = "part2", param = "param";
            Guid   guidPart = Guid.NewGuid();

            var navigationUrl = new NavigationUrl($"{part1}/{part2}?{param}={guidPart}");

            var queryParser = new NavigationUrlQueryParser(navigationUrl.Segments.LastOrDefault().Query);

            queryParser.WithRequired(param, out System.Guid parsedGuid);

            Assert.AreEqual(guidPart, parsedGuid);
        }
コード例 #4
0
            static public void Initialize(Form mainForm, OpenWorkDocumentHandle openHandle,
                                          NavigationUrl navigationUrl, Action reloadTree, Action showDialogForCreateProject,
                                          Action showDialogForOpenProject, Action <string> gotoTree, Action <Form> activateForm)
            {
                if (_isInited)
                {
                    return;
                }

                _mainForm      = mainForm;
                _openHandle    = openHandle;
                _navigationUrl = navigationUrl;
                _reloadTree    = reloadTree;
                _showDialogForCreateProject = showDialogForCreateProject;
                _showDialogForOpenProject   = showDialogForOpenProject;
                _gotoTree     = gotoTree;
                _activateForm = activateForm;

                _isInited = true;
            }