Пример #1
0
        private static ProcessId FixRootName(string pid)
        {
            ProcessId cpid = pid;

            return(cpid.Take(1).Name.Value == "root"
                ? Root(cpid.System).Append(cpid.Skip(1))
                : cpid);
        }
Пример #2
0
        public void TestSelectionIds()
        {
            ProcessId test = "/disp/broadcast/[/root/user/a,/root/user/b,/root/user/c]";

            Assert.True(test.Take(1).GetName() == "disp");
            Assert.True(test.Skip(1).Take(1).GetName() == "broadcast");
            Assert.True(test.Skip(2).Take(1).GetName() == "[/root/user/a,/root/user/b,/root/user/c]");
            Assert.True(test.Skip(2).Take(1).IsSelection);
            Assert.True(test.Skip(2).Take(1).GetSelection().Count() == 3);
            Assert.True(test.Skip(2).Take(1).GetSelection().First().Path == "/root/user/a");
            Assert.True(test.Skip(2).Take(1).GetSelection().Skip(1).First().Path == "/root/user/b");
            Assert.True(test.Skip(2).Take(1).GetSelection().Skip(2).First().Path == "/root/user/c");
        }
        public void TestSelectionIds()
        {
            lock (ProcessTests.sync)
            {
                Process.shutdownAll();
                ProcessConfig.initialise();

                ProcessId test = "/disp/broadcast/[/root/user/a,/root/user/b,/root/user/c]";

                Assert.True(test.Take(1).Name == "disp");
                Assert.True(test.Skip(1).Take(1).Name == "broadcast");
                Assert.True(test.Skip(2).Take(1).Name == "[/root/user/a,/root/user/b,/root/user/c]");
                Assert.True(test.Skip(2).Take(1).IsSelection);
                Assert.True(test.Skip(2).Take(1).GetSelection().Count() == 3);
                Assert.True(test.Skip(2).Take(1).GetSelection().First().Path == "/root/user/a");
                Assert.True(test.Skip(2).Take(1).GetSelection().Skip(1).First().Path == "/root/user/b");
                Assert.True(test.Skip(2).Take(1).GetSelection().Skip(2).First().Path == "/root/user/c");
            }
        }